x86/thunk: (Mis)align __x86_indirect_thunk_* to mitigate ITS

The Indirect Target Selection speculative vulnerability means that indirect
branches (including RETs) are unsafe when in the first half of a cacheline.

Arrange for __x86_indirect_thunk_* to always be in the second half.

This is part of XSA-469 / CVE-2024-28956

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit d293cc9da9)
This commit is contained in:
Jan Beulich authored and Andrew Cooper committed 2025-05-12 17:27:09 +01:00
1 parent 5992d3ab9f
commit f81f44393f
1 file changed
+14
+14
View File
@@ -11,6 +11,10 @@
#include <asm/asm_defns.h>
/* Alignment is dealt with explicitly here; override the respective macro. */
#undef SYM_ALIGN
#define SYM_ALIGN(align...)
.macro IND_THUNK_RETPOLINE reg:req
call 1f
int3
@@ -35,6 +39,16 @@
.macro GEN_INDIRECT_THUNK reg:req
.section .text.__x86_indirect_thunk_\reg, "ax", @progbits
/*
* The Indirect Target Selection speculative vulnerability means that
* indirect branches (including RETs) are unsafe when in the first
* half of a cacheline. Arrange for them to be in the second half.
*
* Align to 64, then skip 32.
*/
.balign 64
.fill 32, 1, 0xcc
FUNC(__x86_indirect_thunk_\reg)
ALTERNATIVE_2 __stringify(IND_THUNK_RETPOLINE \reg), \
__stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.