Skip to content

Commit 9a48d60

Browse files
bp3tk0vtorvalds
authored andcommitted
x86/retbleed: Fix return thunk alignment
SYM_FUNC_START_LOCAL_NOALIGN() adds an endbr leading to this layout (leaving only the last 2 bytes of the address): 3bff <zen_untrain_ret>: 3bff: f3 0f 1e fa endbr64 3c03: f6 test $0xcc,%bl 3c04 <__x86_return_thunk>: 3c04: c3 ret 3c05: cc int3 3c06: 0f ae e8 lfence However, "the RET at __x86_return_thunk must be on a 64 byte boundary, for alignment within the BTB." Use SYM_START instead. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: <stable@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 76c7f88 commit 9a48d60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/lib/retpoline.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
144144
*/
145145
.align 64
146146
.skip 63, 0xcc
147-
SYM_FUNC_START_NOALIGN(zen_untrain_ret);
148-
147+
SYM_START(zen_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
148+
ANNOTATE_NOENDBR
149149
/*
150150
* As executed from zen_untrain_ret, this is:
151151
*

0 commit comments

Comments
 (0)