Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280AbbLDAMU (ORCPT ); Thu, 3 Dec 2015 19:12:20 -0500 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:33021 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946AbbLDAMP convert rfc822-to-8bit (ORCPT ); Thu, 3 Dec 2015 19:12:15 -0500 From: Kosuke Tatsukawa To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "x86@kernel.org" CC: Matt Fleming , "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH 2/2] x86: Fix error in kernel_map_pages_in_pgd() when booting with XD disabled Thread-Topic: [PATCH 2/2] x86: Fix error in kernel_map_pages_in_pgd() when booting with XD disabled Thread-Index: AdEuJoX+9cJAb9neRzKGJggh6VgKNg== Date: Thu, 3 Dec 2015 23:58:36 +0000 Message-ID: <17EC94B0A072C34B8DCF0D30AD16044A0288E2E6@BPXM09GP.gisp.nec.co.jp> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.34.125.78] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1781 Lines: 50 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 --- 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; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/