From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751302AbeACQY4 (ORCPT + 1 other); Wed, 3 Jan 2018 11:24:56 -0500 Received: from terminus.zytor.com ([65.50.211.136]:54657 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837AbeACQYx (ORCPT ); Wed, 3 Jan 2018 11:24:53 -0500 Date: Wed, 3 Jan 2018 08:19:32 -0800 From: tip-bot for Ard Biesheuvel Message-ID: Cc: matt@codeblueprint.co.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, arvind.yadav.cs@gmail.com, hpa@zytor.com, tbaicar@codeaurora.org, ard.biesheuvel@linaro.org, tglx@linutronix.de, gomonovych@gmail.com, sboyd@codeaurora.org, mingo@kernel.org, peterz@infradead.org Reply-To: arvind.yadav.cs@gmail.com, hpa@zytor.com, tbaicar@codeaurora.org, ard.biesheuvel@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org, gomonovych@gmail.com, peterz@infradead.org, mingo@kernel.org, matt@codeblueprint.co.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org In-Reply-To: <20180102181042.19074-3-ard.biesheuvel@linaro.org> References: <20180102181042.19074-3-ard.biesheuvel@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] arm64/efi: Ignore EFI_MEMORY_XP attribute if RP and/or WP are set Git-Commit-ID: 1e9de1d2207d67b97bb0b62e38454b663d6542fa 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: 1e9de1d2207d67b97bb0b62e38454b663d6542fa Gitweb: https://git.kernel.org/tip/1e9de1d2207d67b97bb0b62e38454b663d6542fa Author: Ard Biesheuvel AuthorDate: Tue, 2 Jan 2018 18:10:39 +0000 Committer: Ingo Molnar CommitDate: Wed, 3 Jan 2018 14:03:48 +0100 arm64/efi: Ignore EFI_MEMORY_XP attribute if RP and/or WP are set The UEFI memory map is a bit vague about how to interpret the EFI_MEMORY_XP attribute when it is combined with EFI_MEMORY_RP and/or EFI_MEMORY_WP, which have retroactively been redefined as cacheability attributes rather than permission attributes. So let's ignore EFI_MEMORY_XP if _RP and/or _WP are also set. In this case, it is likely that they are being used to describe the capability of the region (i.e., whether it has the controls to reconfigure it as non-executable) rather than the nature of the contents of the region (i.e., whether it contains data that we will never attempt to execute) Reported-by: Stephen Boyd Tested-by: Stephen Boyd Signed-off-by: Ard Biesheuvel Cc: Arvind Yadav Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tyler Baicar Cc: Vasyl Gomonovych Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20180102181042.19074-3-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar --- arch/arm64/kernel/efi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 82cd075..f85ac58 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -48,7 +48,9 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md) return pgprot_val(PAGE_KERNEL_ROX); /* RW- */ - if (attr & EFI_MEMORY_XP || type != EFI_RUNTIME_SERVICES_CODE) + if (((attr & (EFI_MEMORY_RP | EFI_MEMORY_WP | EFI_MEMORY_XP)) == + EFI_MEMORY_XP) || + type != EFI_RUNTIME_SERVICES_CODE) return pgprot_val(PAGE_KERNEL); /* RWX */