efi/libstub/x86: Use mandatory 16-byte stack alignment in mixed mode
authorArd Biesheuvel <ardb@kernel.org>
Mon, 13 Jan 2020 17:22:34 +0000 (18:22 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 20 Jan 2020 07:13:00 +0000 (08:13 +0100)
commitac3c76cc6d6deef573dd8c14232f20c6aa744f83
tree673d8fbc45dd8cd8e4252d1092f40cc4e6028704
parent796eb8d26a57f917bf22d781666aeab491f5c4f1
efi/libstub/x86: Use mandatory 16-byte stack alignment in mixed mode

Reduce the stack frame of the EFI stub's mixed mode thunk routine by
8 bytes, by moving the GDT and return addresses to EBP and EBX, which
we need to preserve anyway, since their top halves will be cleared by
the call into 32-bit firmware code. Doing so results in the UEFI code
being entered with a 16 byte aligned stack, as mandated by the UEFI
spec, fixing the last occurrence in the 64-bit kernel where we violate
this requirement.

Also, move the saved GDT from a global variable to an unused part of the
stack frame, and touch up some other parts of the code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200113172245.27925-3-ardb@kernel.org
arch/x86/boot/compressed/efi_thunk_64.S