]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/retbleed: Fix return thunk alignment
authorBorislav Petkov (AMD) <bp@alien8.de>
Fri, 12 May 2023 21:12:26 +0000 (23:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:53:41 +0000 (11:53 +0200)
commit000322b29c01efac4dba4cb30ac2d78accca8d65
treea2750a65febb22d4dbea6cb5d1198bf004b5e045
parent2feac714c6818f7767cfc21a3c10fa926b7398a3
x86/retbleed: Fix return thunk alignment

commit 9a48d604672220545d209e9996c2a1edbb5637f6 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/lib/retpoline.S