aboutsummaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
authorMarco Elver2020-11-24 12:02:09 +0100
committerPaul E. McKenney2021-01-04 14:39:07 -0800
commit71a076f4a61a6c779794ad286f356b39725edc3b (patch)
treeaac4f289d877fee6e9ad7dbed32c3c0fc80efce0 /.clang-format
parent5c8fe583cce542aa0b84adc939ce85293de36e5e (diff)
kcsan: Rewrite kcsan_prandom_u32_max() without prandom_u32_state()
Rewrite kcsan_prandom_u32_max() to not depend on code that might be instrumented, removing any dependency on lib/random32.c. The rewrite implements a simple linear congruential generator, that is sufficient for our purposes (for udelay() and skip_watch counter randomness). The initial motivation for this was to allow enabling KCSAN for kernel/sched (remove KCSAN_SANITIZE := n from kernel/sched/Makefile), with CONFIG_DEBUG_PREEMPT=y. Without this change, we could observe recursion: check_access() [via instrumentation] kcsan_setup_watchpoint() reset_kcsan_skip() kcsan_prandom_u32_max() get_cpu_var() preempt_disable() preempt_count_add() [in kernel/sched/core.c] check_access() [via instrumentation] Note, while this currently does not affect an unmodified kernel, it'd be good to keep a KCSAN kernel working when KCSAN_SANITIZE := n is removed from kernel/sched/Makefile to permit testing scheduler code with KCSAN if desired. Fixes: cd290ec24633 ("kcsan: Use tracing-safe version of prandom") Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to '.clang-format')
0 files changed, 0 insertions, 0 deletions