]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/speculation: Add a conditional CS prefix to CALL_NOSPEC
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>
Sat, 17 May 2025 00:00:15 +0000 (17:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:08:23 +0000 (14:08 +0200)
commit2d69c40c820a459e940d23321f6fe2a0ca1aefd5
tree4fecdefe8b9166b3f305d62e06a515febb578231
parent175b3cb84685e3563ca995847e9b6015a2b1499d
x86/speculation: Add a conditional CS prefix to CALL_NOSPEC

commit 052040e34c08428a5a388b85787e8531970c0c67 upstream.

Retpoline mitigation for spectre-v2 uses thunks for indirect branches. To
support this mitigation compilers add a CS prefix with
-mindirect-branch-cs-prefix. For an indirect branch in asm, this needs to
be added manually.

CS prefix is already being added to indirect branches in asm files, but not
in inline asm. Add CS prefix to CALL_NOSPEC for inline asm as well. There
is no JMP_NOSPEC for inline asm.

Reported-by: Josh Poimboeuf <jpoimboe@kernel.org>
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-2-96599fed0f33@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/nospec-branch.h