]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.7.3/x86-platform-uv-skip-uv-runtime-services-mapping-in-the-efi_runtime_disabled-case.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / x86-platform-uv-skip-uv-runtime-services-mapping-in-the-efi_runtime_disabled-case.patch
CommitLineData
6cfd1cde
GKH
1From f72075c9eda8a43aeea2f9dbb8d187afd4a76f0b Mon Sep 17 00:00:00 2001
2From: Alex Thorlton <athorlton@sgi.com>
3Date: Thu, 11 Aug 2016 11:41:59 +0100
4Subject: x86/platform/uv: Skip UV runtime services mapping in the efi_runtime_disabled case
5
6From: Alex Thorlton <athorlton@sgi.com>
7
8commit f72075c9eda8a43aeea2f9dbb8d187afd4a76f0b upstream.
9
10This problem has actually been in the UV code for a while, but we didn't
11catch it until recently, because we had been relying on EFI_OLD_MEMMAP
12to allow our systems to boot for a period of time. We noticed the issue
13when trying to kexec a recent community kernel, where we hit this NULL
14pointer dereference in efi_sync_low_kernel_mappings():
15
16 [ 0.337515] BUG: unable to handle kernel NULL pointer dereference at 0000000000000880
17 [ 0.346276] IP: [<ffffffff8105df8d>] efi_sync_low_kernel_mappings+0x5d/0x1b0
18
19The problem doesn't show up with EFI_OLD_MEMMAP because we skip the
20chunk of setup_efi_state() that sets the efi_loader_signature for the
21kexec'd kernel. When the kexec'd kernel boots, it won't set EFI_BOOT in
22setup_arch, so we completely avoid the bug.
23
24We always kexec with noefi on the command line, so this shouldn't be an
25issue, but since we're not actually checking for efi_runtime_disabled in
26uv_bios_init(), we end up trying to do EFI runtime callbacks when we
27shouldn't be. This patch just adds a check for efi_runtime_disabled in
28uv_bios_init() so that we don't map in uv_systab when runtime_disabled ==
29true.
30
31Signed-off-by: Alex Thorlton <athorlton@sgi.com>
32Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
33Cc: Andy Lutomirski <luto@kernel.org>
34Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
35Cc: Borislav Petkov <bp@alien8.de>
36Cc: Borislav Petkov <bp@suse.de>
37Cc: Brian Gerst <brgerst@gmail.com>
38Cc: Denys Vlasenko <dvlasenk@redhat.com>
39Cc: H. Peter Anvin <hpa@zytor.com>
40Cc: Josh Poimboeuf <jpoimboe@redhat.com>
41Cc: Linus Torvalds <torvalds@linux-foundation.org>
42Cc: Mike Travis <travis@sgi.com>
43Cc: Peter Zijlstra <peterz@infradead.org>
44Cc: Russ Anderson <rja@sgi.com>
45Cc: Thomas Gleixner <tglx@linutronix.de>
46Cc: linux-efi@vger.kernel.org
47Link: http://lkml.kernel.org/r/1470912120-22831-2-git-send-email-matt@codeblueprint.co.uk
48Signed-off-by: Ingo Molnar <mingo@kernel.org>
49Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50
51---
52 arch/x86/platform/uv/bios_uv.c | 3 ++-
53 1 file changed, 2 insertions(+), 1 deletion(-)
54
55--- a/arch/x86/platform/uv/bios_uv.c
56+++ b/arch/x86/platform/uv/bios_uv.c
57@@ -188,7 +188,8 @@ EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga
58 void uv_bios_init(void)
59 {
60 uv_systab = NULL;
61- if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab) {
62+ if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) ||
63+ !efi.uv_systab || efi_runtime_disabled()) {
64 pr_crit("UV: UVsystab: missing\n");
65 return;
66 }