[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220616200548.GT1790663@paulmck-ThinkPad-P17-Gen-1>
Date: Thu, 16 Jun 2022 13:05:48 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: kernel test robot <lkp@...el.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [paulmck-rcu:pmladek.2022.06.15a] BUILD SUCCESS WITH WARNING
0ba7324b44282870af740a5a121add62c7f5f730
On Fri, Jun 17, 2022 at 03:33:27AM +0800, kernel test robot wrote:
> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git pmladek.2022.06.15a
> branch HEAD: 0ba7324b44282870af740a5a121add62c7f5f730 printk: Wait for the global console lock when the system is going down
>
> Warning reports:
>
> https://lore.kernel.org/lkml/202206160411.v3iL3YC0-lkp@intel.com
> https://lore.kernel.org/llvm/202206160421.Gnl3tpxc-lkp@intel.com
>
> Warning: (recently discovered and may have been fixed)
>
> vmlinux.o: warning: objtool: __ct_user_enter+0x7f: call to __kasan_check_read() leaves .noinstr.text section
> vmlinux.o: warning: objtool: __ct_user_exit+0x41: call to __kasan_check_read() leaves .noinstr.text section
Here is the alleged fix, and thank you for testing!
Thanx, Paul
------------------------------------------------------------------------
commit 571252796c089880b804835f6cfc9c3da3ae8c4f
Author: Paul E. McKenney <paulmck@...nel.org>
Date: Thu Jun 16 09:30:37 2022 -0700
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.
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Cc: Frederic Weisbecker <frederic@...nel.org>
Cc: Marco Elver <elver@...gle.com>
Reviewed-by: Marco Elver <elver@...gle.com>
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 0aecc07fb4f50..81c51e5f03143 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
Powered by blists - more mailing lists