[<prev] [next>] [day] [month] [year] [list]
Message-ID: <166490685372.401.8724006488941040622.tip-bot2@tip-bot2>
Date: Tue, 04 Oct 2022 18:07:33 -0000
From: "tip-bot2 for Dave Hansen" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Guenter Roeck <linux@...ck-us.net>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ard Biesheuvel <ardb@...nel.org>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, linux-efi@...r.kernel.org,
"H. Peter Anvin" <hpa@...or.com>,
Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Subject: [tip: x86/mm] x86/mm: Disable W^X detection and enforcement on 32-bit
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 8c4934f4754057e3577bb1536c6ecc0efa2c966e
Gitweb: https://git.kernel.org/tip/8c4934f4754057e3577bb1536c6ecc0efa2c966e
Author: Dave Hansen <dave.hansen@...ux.intel.com>
AuthorDate: Fri, 23 Sep 2022 14:29:45 -07:00
Committer: Dave Hansen <dave.hansen@...ux.intel.com>
CommitterDate: Mon, 03 Oct 2022 13:12:23 -07:00
x86/mm: Disable W^X detection and enforcement on 32-bit
The 32-bit code is in a weird spot. Some 32-bit builds (non-PAE) do not
even have NX support. Even PAE builds that support NX have to contend
with things like EFI data and code mixed in the same pages where W+X
is unavoidable.
The folks still running X86_32=y kernels are unlikely to care much about
NX. That combined with the fundamental inability fix _all_ of the W+X
things means this code had little value on X86_32=y. Disable the checks.
Reported-by: Guenter Roeck <linux@...ck-us.net>
Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: Darren Hart <dvhart@...radead.org>
Cc: Andy Shevchenko <andy@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: x86@...nel.org
Cc: linux-efi@...r.kernel.org
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Kees Cook <keescook@...omium.org>
Link: https://lore.kernel.org/all/CAMj1kXHcF_iK_g0OZSkSv56Wmr=eQGQwNstcNjLEfS=mm7a06w@mail.gmail.com/
---
arch/x86/mm/pat/set_memory.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 20b1e24..efe882c 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -587,6 +587,14 @@ static inline pgprot_t verify_rwx(pgprot_t old, pgprot_t new, unsigned long star
{
unsigned long end;
+ /*
+ * 32-bit has some unfixable W+X issues, like EFI code
+ * and writeable data being in the same page. Disable
+ * detection and enforcement there.
+ */
+ if (IS_ENABLED(CONFIG_X86_32))
+ return new;
+
/* Only enforce when NX is supported: */
if (!(__supported_pte_mask & _PAGE_NX))
return new;
Powered by blists - more mailing lists