[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221002103336.GB10085@duo.ucw.cz>
Date: Sun, 2 Oct 2022 12:33:36 +0200
From: Pavel Machek <pavel@....cz>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>,
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>
Subject: Re: [PATCH] x86/mm: Disable W^X detection and enforcement on 32-bit
Hi!
> 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.
> ---
> 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 20b1e24baa85..efe882c753ca 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;
> +
You are going from extreme to extreme. W^X is useful on x86-32 at
least in some configs, so it would make sense to detect and inform
about the issues (perhaps with something like KERN_INFO).
Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists