[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [RFC PATCH 25/28] x86: Use PIE codegen for the core kernel
- To: 'Uros Bizjak' <ubizjak@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>
- From: David Laight <David.Laight@xxxxxxxxxx>
- Date: Sun, 6 Oct 2024 18:00:09 +0000
- Accept-language: en-GB, en-US
- Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Ard Biesheuvel <ardb+git@xxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, "Peter Zijlstra" <peterz@xxxxxxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Christoph Lameter <cl@xxxxxxxxx>, Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, "Vitaly Kuznetsov" <vkuznets@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Boris Ostrovsky" <boris.ostrovsky@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Masahiro Yamada <masahiroy@xxxxxxxxxx>, Kees Cook <kees@xxxxxxxxxx>, Nathan Chancellor <nathan@xxxxxxxxxx>, Keith Packard <keithp@xxxxxxxxxx>, Justin Stitt <justinstitt@xxxxxxxxxx>, Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, "Arnaldo Carvalho de Melo" <acme@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, "Jiri Olsa" <jolsa@xxxxxxxxxx>, Ian Rogers <irogers@xxxxxxxxxx>, Adrian Hunter <adrian.hunter@xxxxxxxxx>, Kan Liang <kan.liang@xxxxxxxxxxxxxxx>, "linux-doc@xxxxxxxxxxxxxxx" <linux-doc@xxxxxxxxxxxxxxx>, "linux-pm@xxxxxxxxxxxxxxx" <linux-pm@xxxxxxxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" <kvm@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-efi@xxxxxxxxxxxxxxx" <linux-efi@xxxxxxxxxxxxxxx>, "linux-arch@xxxxxxxxxxxxxxx" <linux-arch@xxxxxxxxxxxxxxx>, "linux-sparse@xxxxxxxxxxxxxxx" <linux-sparse@xxxxxxxxxxxxxxx>, "linux-kbuild@xxxxxxxxxxxxxxx" <linux-kbuild@xxxxxxxxxxxxxxx>, "linux-perf-users@xxxxxxxxxxxxxxx" <linux-perf-users@xxxxxxxxxxxxxxx>, "rust-for-linux@xxxxxxxxxxxxxxx" <rust-for-linux@xxxxxxxxxxxxxxx>, "llvm@xxxxxxxxxxxxxxx" <llvm@xxxxxxxxxxxxxxx>
- Delivery-date: Sun, 06 Oct 2024 18:01:16 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbF8Wqw+hKPqg6T0aWZJZtJXxJh7J5/LJw
- Thread-topic: [RFC PATCH 25/28] x86: Use PIE codegen for the core kernel
...
> 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?
While x86-84 code (ignoring data references) is pretty much always
position independent, the same isn't true of all architectures.
Some (at least Nios-II) only have absolute call instructions.
So you can't really move to pic code globally.
You'd also want 'bad' pic code that contained some fixups that
needed the code patching.
(Which you really don't want for a shared library.)
Otherwise you get an extra instruction for non-trivial data
accesses.
Thinking....
Doesn't the code generated for -fpic assume that the dynamic loader
has processed the relocations before it is run?
But the kernel startup code is running before they can have been done?
So even if that C code were 'pic' it could still contain things that
are invalid (probably arrays of pointers?).
So you lose one set of bugs and gain another.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT,
UK
Registration No: 1397386 (Wales)
|