[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bfa1a86c3e4348159049e8277e9859dd@AcuMS.aculab.com>
Date: Sun, 6 Oct 2024 18:00:09 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Uros Bizjak' <ubizjak@...il.com>, "H. Peter Anvin" <hpa@...or.com>
CC: Ard Biesheuvel <ardb@...nel.org>, Linus Torvalds
<torvalds@...ux-foundation.org>, Ard Biesheuvel <ardb+git@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>, Andy Lutomirski <luto@...nel.org>, "Peter
Zijlstra" <peterz@...radead.org>, Dennis Zhou <dennis@...nel.org>, Tejun Heo
<tj@...nel.org>, Christoph Lameter <cl@...ux.com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Paolo Bonzini <pbonzini@...hat.com>,
"Vitaly Kuznetsov" <vkuznets@...hat.com>, Juergen Gross <jgross@...e.com>,
"Boris Ostrovsky" <boris.ostrovsky@...cle.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Arnd Bergmann <arnd@...db.de>, Masahiro Yamada
<masahiroy@...nel.org>, Kees Cook <kees@...nel.org>, Nathan Chancellor
<nathan@...nel.org>, Keith Packard <keithp@...thp.com>, Justin Stitt
<justinstitt@...gle.com>, Josh Poimboeuf <jpoimboe@...nel.org>, "Arnaldo
Carvalho de Melo" <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
"Jiri Olsa" <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>, Adrian
Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "xen-devel@...ts.xenproject.org"
<xen-devel@...ts.xenproject.org>, "linux-efi@...r.kernel.org"
<linux-efi@...r.kernel.org>, "linux-arch@...r.kernel.org"
<linux-arch@...r.kernel.org>, "linux-sparse@...r.kernel.org"
<linux-sparse@...r.kernel.org>, "linux-kbuild@...r.kernel.org"
<linux-kbuild@...r.kernel.org>, "linux-perf-users@...r.kernel.org"
<linux-perf-users@...r.kernel.org>, "rust-for-linux@...r.kernel.org"
<rust-for-linux@...r.kernel.org>, "llvm@...ts.linux.dev"
<llvm@...ts.linux.dev>
Subject: RE: [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)
Powered by blists - more mailing lists