]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/kcsan: Exclude udelay to prevent recursive instrumentation
authorRohan McLure <rmclure@linux.ibm.com>
Mon, 6 Feb 2023 02:17:58 +0000 (13:17 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:31 +0000 (08:50 +0100)
[ Upstream commit a182728806b796ce72488b8772a8a85684321a16 ]

In order for KCSAN to increase its likelihood of observing a data race,
it sets a watchpoint on memory accesses and stalls, allowing for
detection of conflicting accesses by other kernel threads or interrupts.

Stalls are implemented by injecting a call to udelay in instrumented code.
To prevent recursive instrumentation, exclude udelay from being instrumented.

Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230206021801.105268-3-rmclure@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kernel/time.c

index f157552d79b38f0c1e04d22e6704f63eed63c7c1..285159e65a3bac0465582f6dbac7f78af65264a6 100644 (file)
@@ -374,7 +374,7 @@ void vtime_flush(struct task_struct *tsk)
 #define calc_cputime_factors()
 #endif
 
-void __delay(unsigned long loops)
+void __no_kcsan __delay(unsigned long loops)
 {
        unsigned long start;
 
@@ -395,7 +395,7 @@ void __delay(unsigned long loops)
 }
 EXPORT_SYMBOL(__delay);
 
-void udelay(unsigned long usecs)
+void __no_kcsan udelay(unsigned long usecs)
 {
        __delay(tb_ticks_per_usec * usecs);
 }