Skip to content

Commit 8c4934f

Browse files
committed
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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Darren Hart <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: [email protected] Cc: [email protected] Cc: "H. Peter Anvin" <[email protected]> Cc: Kees Cook <[email protected]> Link: https://lore.kernel.org/all/CAMj1kXHcF_iK_g0OZSkSv56Wmr=eQGQwNstcNjLEfS=mm7a06w@mail.gmail.com/
1 parent 334b2ce commit 8c4934f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/x86/mm/pat/set_memory.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,14 @@ static inline pgprot_t verify_rwx(pgprot_t old, pgprot_t new, unsigned long star
587587
{
588588
unsigned long end;
589589

590+
/*
591+
* 32-bit has some unfixable W+X issues, like EFI code
592+
* and writeable data being in the same page. Disable
593+
* detection and enforcement there.
594+
*/
595+
if (IS_ENABLED(CONFIG_X86_32))
596+
return new;
597+
590598
/* Only enforce when NX is supported: */
591599
if (!(__supported_pte_mask & _PAGE_NX))
592600
return new;

0 commit comments

Comments
 (0)