[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230405174059.GEZC2yq9WiXFsICyEy@fat_crate.local>
Date: Wed, 5 Apr 2023 19:40:59 +0200
From: Borislav Petkov <bp@...en8.de>
To: Evgeniy Baskov <baskov@...ras.ru>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
Peter Jones <pjones@...hat.com>,
Gerd Hoffmann <kraxel@...hat.com>,
"Limonciello, Mario" <mario.limonciello@....com>,
joeyli <jlee@...e.com>, lvc-project@...uxtesting.org,
x86@...nel.org, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v5 02/27] x86/build: Remove RWX sections and align on 4KB
On Tue, Mar 14, 2023 at 01:13:29PM +0300, Evgeniy Baskov wrote:
> Avoid creating sections simultaneously writable and readable to prepare
> for W^X implementation for the kernel itself (not the decompressor).
> Align kernel sections on page size (4KB) to allow protecting them in the
> page tables.
>
> Split init code form ".init" segment into separate R_X ".inittext"
s/form/from/
> segment and make ".init" segment non-executable.
"... and make the .init segment RW_."
> Also add these segments to x86_32 architecture for consistency.
Same comment as before: please refrain from talking about the *what* in
a commit message but about the *why*.
And considering the matter, you have a *lot* of *why* to talk about. :-)
Pls check your whole set.
> Currently paging is disabled in x86_32 in compressed kernel, so
> protection is not applied anyways, but .init code was incorrectly
> placed in non-executable ".data" segment. This should not change
> anything meaningful in memory layout now, but might be required in case
> memory protection will also be implemented in compressed kernel for
> x86_32.
I highly doubt that - no one cares about 32-bit x86 anymore.
> @@ -226,9 +225,10 @@ SECTIONS
> #endif
>
> INIT_TEXT_SECTION(PAGE_SIZE)
> -#ifdef CONFIG_X86_64
> - :init
> -#endif
> + :inittext
> +
> + . = ALIGN(PAGE_SIZE);
> +
>
> /*
> * Section for code used exclusively before alternatives are run. All
> @@ -240,6 +240,7 @@ SECTIONS
> .altinstr_aux : AT(ADDR(.altinstr_aux) - LOAD_OFFSET) {
> *(.altinstr_aux)
> }
> + :init
Why isn't this placed after inittext but here?
I'm thinking you wanna have:
:inittext
. = ALIGN..
:init
<rest>
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists