]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0248-x86-pti-Unbreak-EFI-old_memmap.patch
update ABI file
[pve-kernel.git] / patches / kernel / 0248-x86-pti-Unbreak-EFI-old_memmap.patch
CommitLineData
035dbe67
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Jiri Kosina <jkosina@suse.cz>
3Date: Fri, 5 Jan 2018 22:35:41 +0100
4Subject: [PATCH] x86/pti: Unbreak EFI old_memmap
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2017-5754
10
11EFI_OLD_MEMMAP's efi_call_phys_prolog() calls set_pgd() with swapper PGD that
12has PAGE_USER set, which makes PTI set NX on it, and therefore EFI can't
13execute it's code.
14
15Fix that by forcefully clearing _PAGE_NX from the PGD (this can't be done
16by the pgprot API).
17
18_PAGE_NX will be automatically reintroduced in efi_call_phys_epilog(), as
19_set_pgd() will again notice that this is _PAGE_USER, and set _PAGE_NX on
20it.
21
22Tested-by: Dimitri Sivanich <sivanich@hpe.com>
23Signed-off-by: Jiri Kosina <jkosina@suse.cz>
24Signed-off-by: Ingo Molnar <mingo@kernel.org>
25Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
26Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
27Cc: Andrea Arcangeli <aarcange@redhat.com>
28Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
29Cc: Linus Torvalds <torvalds@linux-foundation.org>
30Cc: Matt Fleming <matt@codeblueprint.co.uk>
31Cc: Peter Zijlstra <peterz@infradead.org>
32Cc: Thomas Gleixner <tglx@linutronix.de>
33Cc: linux-efi@vger.kernel.org
34Cc: stable@vger.kernel.org
35Link: http://lkml.kernel.org/r/nycvar.YFH.7.76.1801052215460.11852@cbobk.fhfr.pm
36(cherry picked from commit de53c3786a3ce162a1c815d0c04c766c23ec9c0a)
37Signed-off-by: Andy Whitcroft <apw@canonical.com>
38Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
39(cherry picked from commit 31afacd8089f54061e718e5d491f11747755c503)
40Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
41---
42 arch/x86/platform/efi/efi_64.c | 2 ++
43 1 file changed, 2 insertions(+)
44
45diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
46index b104224d3d6c..987a38e82f73 100644
47--- a/arch/x86/platform/efi/efi_64.c
48+++ b/arch/x86/platform/efi/efi_64.c
49@@ -133,7 +133,9 @@ pgd_t * __init efi_call_phys_prolog(void)
50 pud[j] = *pud_offset(p4d_k, vaddr);
51 }
52 }
53+ pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX;
54 }
55+
56 out:
57 __flush_tlb_all();
58
59--
602.14.2
61