diff mbox series

[v4,19/30] stackleack: Mark stack_erasing_bypass key as allowed in .noinstr

Message ID 20250114175143.81438-20-vschneid@redhat.com (mailing list archive)
State Handled Elsewhere
Headers show
Series context_tracking,x86: Defer some IPIs until a user->kernel transition | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-19-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 139.49s
conchuod/patch-19-test-2 fail .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1007.09s
conchuod/patch-19-test-3 fail .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1230.06s
conchuod/patch-19-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 21.12s
conchuod/patch-19-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 23.16s
conchuod/patch-19-test-6 warning .github/scripts/patches/tests/checkpatch.sh took 0.45s
conchuod/patch-19-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 44.53s
conchuod/patch-19-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.01s
conchuod/patch-19-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.55s
conchuod/patch-19-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-19-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-19-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.04s

Commit Message

Valentin Schneider Jan. 14, 2025, 5:51 p.m. UTC
Later commits will cause objtool to warn about static keys being used in
.noinstr sections in order to safely defer instruction patching IPIs
targeted at NOHZ_FULL CPUs.

stack_erasing_bypass is used in .noinstr code, and can be modified at runtime
(proc/sys/kernel/stack_erasing write). However it is not expected that it
will be  flipped during latency-sensitive operations, and thus shouldn't be
a source of interference wrt the text patching IPI.

Mark it to let objtool know not to warn about it.

Reported-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
 kernel/stackleak.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index 39fd620a7db6f..a4f07fbc13f61 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -18,7 +18,11 @@ 
 #include <linux/sysctl.h>
 #include <linux/init.h>
 
-static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
+/*
+ * This static key can only be modified via its sysctl interface. It is
+ * expected it will remain stable during latency-senstive operations.
+ */
+static DEFINE_STATIC_KEY_FALSE_NOINSTR(stack_erasing_bypass);
 
 #ifdef CONFIG_SYSCTL
 static int stack_erasing_sysctl(const struct ctl_table *table, int write,