linux/kernel/kcsan
Marco Elver cd290ec246 kcsan: Use tracing-safe version of prandom
In the core runtime, we must minimize any calls to external library
functions to avoid any kind of recursion. This can happen even though
instrumentation is disabled for called functions, but tracing is
enabled.

Most recently, prandom_u32() added a tracepoint, which can cause
problems for KCSAN even if the rcuidle variant is used. For example:
	kcsan -> prandom_u32() -> trace_prandom_u32_rcuidle ->
	srcu_read_lock_notrace -> __srcu_read_lock -> kcsan ...

While we could disable KCSAN in kcsan_setup_watchpoint(), this does not
solve other unexpected behaviour we may get due recursing into functions
that may not be tolerant to such recursion:
	__srcu_read_lock -> kcsan -> ... -> __srcu_read_lock

Therefore, switch to using prandom_u32_state(), which is uninstrumented,
and does not have a tracepoint.

Link: https://lkml.kernel.org/r/20200821063043.1949509-1-elver@google.com
Link: https://lkml.kernel.org/r/20200820172046.GA177701@elver.google.com
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-30 21:50:13 -07:00
..
atomic.h kcsan: Remove existing special atomic rules 2020-06-29 12:04:48 -07:00
core.c kcsan: Use tracing-safe version of prandom 2020-08-30 21:50:13 -07:00
debugfs.c kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
encoding.h kcsan: Prefer __always_inline for fast-path 2020-03-21 09:40:19 +01:00
kcsan-test.c kcsan: Test support for compound instrumentation 2020-08-24 15:09:58 -07:00
kcsan.h kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
Makefile kcsan: Disable branch tracing in core runtime 2020-06-29 12:04:48 -07:00
report.c kcsan: Optimize debugfs stats counters 2020-08-24 15:10:23 -07:00
selftest.c kcsan: Use pr_fmt for consistency 2020-08-24 15:10:23 -07:00