Skip to content

Commit

Permalink
jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
Browse files Browse the repository at this point in the history
[ Upstream commit 656d054 ]

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

Switch to arch_ prefixed atomic to avoid the explicit instrumentation.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Peter Zijlstra authored and gregkh committed Jun 14, 2022
1 parent 320acaf commit cb8da20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/jump_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ extern void static_key_disable_cpuslocked(struct static_key *key);
#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 arch_atomic_read(&key->enabled);
}

static __always_inline void jump_label_init(void)
Expand Down

0 comments on commit cb8da20

Please sign in to comment.