diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2022-06-16 18:30:37 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2022-07-05 22:33:00 +0200 |
commit | 1dcaa3b462265f688613163a1562a65ee53a3311 (patch) | |
tree | 7c3e1ed3c67debadeec5e45110fb9d7380d1f321 | |
parent | MAINTAINERS: Add Paul as context tracking maintainer (diff) | |
download | linux-1dcaa3b462265f688613163a1562a65ee53a3311.tar.xz linux-1dcaa3b462265f688613163a1562a65ee53a3311.zip |
context_tracking: Use arch_atomic_read() in __ct_state for KASAN
Context tracking's __ct_state() function can be invoked from noinstr state
where RCU is not watching. This means that its use of atomic_read()
causes KASAN to invoke the non-noinstr __kasan_check_read() function
from the noinstr function __ct_state(). This is problematic because
someone tracing the __kasan_check_read() function could get a nasty
surprise because of RCU not watching.
This commit therefore replaces the __ct_state() function's use of
atomic_read() with arch_atomic_read(), which KASAN does not attempt to
add instrumention to.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Marco Elver <elver@google.com>
Reviewed-by: Marco Elver <elver@google.com>
-rw-r--r-- | include/linux/context_tracking_state.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h index e20a74bc0597..4a4d56f77180 100644 --- a/include/linux/context_tracking_state.h +++ b/include/linux/context_tracking_state.h @@ -49,7 +49,7 @@ DECLARE_PER_CPU(struct context_tracking, context_tracking); static __always_inline int __ct_state(void) { - return atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK; + return arch_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK; } #endif |