All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] x86: Fix error in kernel_map_pages_in_pgd() when booting with XD disabled
@ 2015-12-03 23:58 Kosuke Tatsukawa
  0 siblings, 0 replies; only message in thread
From: Kosuke Tatsukawa @ 2015-12-03 23:58 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
  Cc: Matt Fleming, linux-efi, linux-kernel

If either the eXecute Disable (XD) bit is set to disabled in uEFI
firmware or noexec=off option is given as kernel boot parameter, the
system comes up with the error message
  Error ident-mapping new memmap (0x13b0ac000)!
and EFI runtime service is unavailable.

This is because kernel_map_pages_in_pgd() checks __supported_pte_mask
and returns an error if _PAGE_NX is not available.  As a result,
efi_setup_page_tables() prints the error message and
__efi_enter_virtual_mode() clears the EFI_RUNTIME_SERVICES bit in
efi.flags.

This patch changes kernel_map_pages_in_pgd() to set up the pte without
_PAGE_NX if the nx capability is unavailable instead of returning an
error.

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
---
 arch/x86/mm/pageattr.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a3137a4..3417c26 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1951,10 +1951,7 @@ int kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address,
 		.flags = 0,
 	};
 
-	if (!(__supported_pte_mask & _PAGE_NX))
-		goto out;
-
-	if (!(page_flags & _PAGE_NX))
+	if ((__supported_pte_mask & _PAGE_NX) && !(page_flags & _PAGE_NX))
 		cpa.mask_clr = __pgprot(_PAGE_NX);
 
 	cpa.mask_set = __pgprot(_PAGE_PRESENT | page_flags);
@@ -1962,7 +1959,6 @@ int kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address,
 	retval = __change_page_attr_set_clr(&cpa, 0);
 	__flush_tlb_all();
 
-out:
 	return retval;
 }
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-04  0:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 23:58 [PATCH 2/2] x86: Fix error in kernel_map_pages_in_pgd() when booting with XD disabled Kosuke Tatsukawa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.