lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
On Mon, 2 May 2022 at 13:12, Peter Zijlstra <peterz@infradead.org> wrote:
>
> When building x86_64 with JUMP_LABEL=n it's possible for
> instrumentation to sneak into noinstr:
>
> vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section
> vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section
> vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> include/linux/jump_label.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -256,9 +256,9 @@ extern void static_key_disable_cpuslocke
> #include <linux/atomic.h>
> #include <linux/bug.h>
>
> -static inline int static_key_count(struct static_key *key)
> +static __always_inline int static_key_count(struct static_key *key)
> {
> - return atomic_read(&key->enabled);
> + return READ_ONCE_NOCHECK(&key->enabled.count);
> }

Did arch_atomic_read() not work? Or should this also be unchecked in
instrumented functions?

\
 
 \ /
  Last update: 2022-05-02 13:25    [W:0.081 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site