[RFC PATCH 19/27] x86/shstk: Remove profiling related dependencies for KERN_SHADOW_STACK
From: K Prateek Nayak
Date: Sun Nov 29 2026 - 17:36:09 EST
Ftrace, optprobes, kprobes, rethooks, livepatch (ftrace direct call),
error injection, and BPF JIT have now been adjusted to handle shadow
stacks for control-flow changes.
Remove the config dependencies to allow building
CONFIG_KERN_SHADOW_STACK with the above configs enabled.
Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
---
arch/x86/Kconfig | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 559b9bc95c38..21f2b41043f4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1907,34 +1907,6 @@ config X86_KERN_SHADOW_STACK
depends on VMAP_STACK
depends on AS_WRUSS
select X86_CET
- # Replaces return addresses on the stack with return_to_handler,
- # and return_to_handler itself returns with a retpoline-style
- # "call; mov %rdi,(%rsp); ret".
- depends on !FUNCTION_GRAPH_TRACER
- # kprobe_emulate_call(), kprobe_emulate_ret() and
- # kprobe_emulate_call_indirect() emulate CALL and RET by moving
- # the return address on the regular stack only. KRETPROBES and
- # OPTPROBES hang off this symbol as well.
- depends on !KPROBES
- # arch_rethook_trampoline() is a return address hijack: the
- # probed function RETs to the trampoline instead of its caller.
- # FPROBE selects RETHOOK.
- depends on !RETHOOK
- depends on !FPROBE
- # klp_ftrace_handler() redirects execution by changing the
- # ftrace_regs IP. ftrace_regs_caller writes that IP into the
- # return slot and RETs to it, but the shadow stack still holds
- # the original address.
- depends on !LIVEPATCH
- # override_function_with_return() points regs->ip at
- # just_return_func, a bare RET that pops the probed function's
- # return address without the function's own RET ever running.
- depends on !FUNCTION_ERROR_INJECTION
- # BPF trampolines with BPF_TRAMP_F_SKIP_FRAME do "add $8,%rsp; ret"
- # to return to the grandparent. bpf_throw() unwinds BPF frames by
- # walking the stack and resuming at the exception callback with
- # the unwound RSP, skipping the intervening RETs.
- depends on !BPF_JIT
# relocate_kernel() switches CR3 and CR4 with a shadow stack live
# and uses "pushq $0 ... ret" as the handoff into purgatory. It
# needs S_CET.SH_STK_EN cleared first, which nothing does yet.
--
2.43.0