From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbeAFL6a (ORCPT + 1 other); Sat, 6 Jan 2018 06:58:30 -0500 Received: from terminus.zytor.com ([65.50.211.136]:58645 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbeAFL62 (ORCPT ); Sat, 6 Jan 2018 06:58:28 -0500 Date: Sat, 6 Jan 2018 03:52:48 -0800 From: tip-bot for Jiri Kosina Message-ID: Cc: aarcange@redhat.com, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, matt@codeblueprint.co.uk, dave.hansen@linux.intel.com, sivanich@hpe.com, jkosina@suse.cz, ard.biesheuvel@linaro.org, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: tglx@linutronix.de, aarcange@redhat.com, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk, dave.hansen@linux.intel.com, sivanich@hpe.com, jkosina@suse.cz, ard.biesheuvel@linaro.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/pti: Unbreak EFI old_memmap Git-Commit-ID: 5ad9a697fa957e61d50ef969179c18348968cd9f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Commit-ID: 5ad9a697fa957e61d50ef969179c18348968cd9f Gitweb: https://git.kernel.org/tip/5ad9a697fa957e61d50ef969179c18348968cd9f Author: Jiri Kosina AuthorDate: Fri, 5 Jan 2018 22:35:41 +0100 Committer: Ingo Molnar CommitDate: Sat, 6 Jan 2018 11:43:44 +0100 x86/pti: Unbreak EFI old_memmap EFI_OLD_MEMMAP's efi_call_phys_prolog() calls set_pgd() with swapper PGD that has PAGE_USER set, which makes PTI set NX on it, and therefore EFI can't execute it's code. Fix that by forcefully clearing _PAGE_NX from the PGD (this can't be done by the pgprot API). _PAGE_NX will be automatically reintroduced in efi_call_phys_epilog(), as _set_pgd() will again notice that this is _PAGE_USER, and set _PAGE_NX on it. Tested-by: Dimitri Sivanich Signed-off-by: Jiri Kosina Acked-by: Dave Hansen Cc: Andrea Arcangeli Cc: Ard Biesheuvel Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/nycvar.YFH.7.76.1801052215460.11852@cbobk.fhfr.pm Signed-off-by: Ingo Molnar --- arch/x86/platform/efi/efi_64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 39c4b35..61975b6 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -134,7 +134,9 @@ pgd_t * __init efi_call_phys_prolog(void) pud[j] = *pud_offset(p4d_k, vaddr); } } + pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; } + out: __flush_tlb_all();