diff options
author | Marco Elver <elver@google.com> | 2020-08-21 14:31:26 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-08-30 21:50:13 -0700 |
commit | cd290ec24633f51029dab0d25505fae7da0e1eda (patch) | |
tree | 7c25a85aad1f29981cd7bddf49039f9e79e66e13 /lib | |
parent | 068df05363b79f54241bd6bd612055b8c16c5964 (diff) |
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>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions