Commit 6393c7c6 authored by Rohan McLure's avatar Rohan McLure Committed by sanglipeng
Browse files

powerpc/kcsan: Exclude udelay to prevent recursive instrumentation

stable inclusion
from stable-v5.10.175
commit 9a61a3a6ec660915b641dacc6ac40bb52cc9e06b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8711T

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9a61a3a6ec660915b641dacc6ac40bb52cc9e06b



--------------------------------

[ Upstream commit 2a7ce82d ]

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: default avatarRohan McLure <rmclure@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230206021801.105268-3-rmclure@linux.ibm.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent b99bab4a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -436,7 +436,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;

@@ -457,7 +457,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);
}