Re: [RFC PATCH 25/28] x86: Use PIE codegen for the core kernel

H. Peter Anvin
2024-10-06T19:39:46Z

On October 6, 2024 12:17:40 PM PDT, Uros Bizjak <ubizjak@gmail.com> wrote:
>On Sun, Oct 6, 2024 at 8:01 PM David Laight <David.Laight@aculab.com> wrote:
>>
>> ...
>> > Due to the non-negligible impact of PIE, perhaps some kind of
>> > CONFIG_PIE config definition should be introduced, so the assembly
>> > code would be able to choose optimal asm sequence when PIE and non-PIE
>> > is requested?
>>
>> I wouldn't have thought that performance mattered in the asm code
>> that runs during startup?
>
>No, not the code that runs only once, where performance impact can be tolerated.
>
>This one:
>
>https://lore.kernel.org/lkml/20240925150059.3955569-44-ardb+git@google.com/
>
>Uros.
>

Yeah, running the kernel proper as PIE seems like a lose all around. The decompressor, ELF stub, etc, are of course a different matter entirely (and at least the latter can't rely on the small or kernel memory models anyway.)