]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/speculation: Simplify and make CALL_NOSPEC consistent
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>
Sat, 1 Mar 2025 02:35:43 +0000 (18:35 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Mar 2025 10:14:35 +0000 (11:14 +0100)
commitcfceff8526a426948b53445c02bcb98453c7330d
treed0d67cceef42b5af0d869b949ca5c346f2728212
parent4e32645cd8f97a308300623f81c902747df6b97b
x86/speculation: Simplify and make CALL_NOSPEC consistent

CALL_NOSPEC macro is used to generate Spectre-v2 mitigation friendly
indirect branches. At compile time the macro defaults to indirect branch,
and at runtime those can be patched to thunk based mitigations.

This approach is opposite of what is done for the rest of the kernel, where
the compile time default is to replace indirect calls with retpoline thunk
calls.

Make CALL_NOSPEC consistent with the rest of the kernel, default to
retpoline thunk at compile time when CONFIG_MITIGATION_RETPOLINE is
enabled.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250228-call-nospec-v3-1-96599fed0f33@linux.intel.com
arch/x86/include/asm/nospec-branch.h