4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Hansen <dave.han...@linux.intel.com>

commit 262b6b30087246abf09d6275eb0c0dc421bcbe38 upstream.

This is another case similar to what EFI does: create a new set of
page tables, map some code at a low address, and jump to it.  PTI
mistakes this low address for userspace and mistakenly marks it
non-executable in an effort to make it unusable for userspace.

Undo the poison to allow execution.

Fixes: 385ce0ea4c07 ("x86/mm/pti: Add Kconfig")
Signed-off-by: Dave Hansen <dave.han...@linux.intel.com>
Signed-off-by: Andrea Arcangeli <aarca...@redhat.com>
Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Cc: Alan Cox <gno...@lxorguk.ukuu.org.uk>
Cc: Tim Chen <tim.c.c...@linux.intel.com>
Cc: Jon Masters <j...@redhat.com>
Cc: Dave Hansen <dave.han...@intel.com>
Cc: Andi Kleen <a...@firstfloor.org>
Cc: Jeff Law <l...@redhat.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Greg Kroah-Hartman <gre...@linux-foundation.org>
Cc: David <d...@amazon.co.uk>
Cc: Nick Clifton <ni...@redhat.com>
Link: https://lkml.kernel.org/r/20180108102805.gk25...@redhat.com
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 arch/x86/kernel/tboot.c |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -127,6 +127,7 @@ static int map_tboot_page(unsigned long
        p4d = p4d_alloc(&tboot_mm, pgd, vaddr);
        if (!p4d)
                return -1;
+       pgd->pgd &= ~_PAGE_NX;
        pud = pud_alloc(&tboot_mm, p4d, vaddr);
        if (!pud)
                return -1;


Reply via email to