]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
efi/x86: Align GUIDs to their size in the mixed mode runtime wrapper
authorArd Biesheuvel <ardb@kernel.org>
Fri, 21 Feb 2020 08:48:46 +0000 (09:48 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 13 Mar 2020 12:38:58 +0000 (13:38 +0100)
commitaec62c46406433f4a7b342920f9db65aa3022008
tree545a54d165c515f9c59b9ef134b41ddff5eb41c3
parente2cbc445a091f1c13bd54b4a5e8899e268307230
efi/x86: Align GUIDs to their size in the mixed mode runtime wrapper

BugLink: https://bugs.launchpad.net/bugs/1867178
commit 63056e8b5ebf41d52170e9f5ba1fc83d1855278c upstream.

Hans reports that his mixed mode systems running v5.6-rc1 kernels hit
the WARN_ON() in virt_to_phys_or_null_size(), caused by the fact that
efi_guid_t objects on the vmap'ed stack happen to be misaligned with
respect to their sizes. As a quick (i.e., backportable) fix, copy GUID
pointer arguments to the local stack into a buffer that is naturally
aligned to its size, so that it is guaranteed to cover only one
physical page.

Note that on x86, we cannot rely on the stack pointer being aligned
the way the compiler expects, so we need to allocate an 8-byte aligned
buffer of sufficient size, and copy the GUID into that buffer at an
offset that is aligned to 16 bytes.

Fixes: f6697df36bdf0bf7 ("x86/efi: Prevent mixed mode boot corruption with CONFIG_VMAP_STACK=y")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Cc: linux-efi@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200221084849.26878-2-ardb@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/platform/efi/efi_64.c