[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de9b93a9f6088322ad5bed79b069a49203517dd7.camel@infradead.org>
Date: Fri, 03 Jan 2025 10:10:00 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>, Eric Biederman
<ebiederm@...ssion.com>, Sourabh Jain <sourabhjain@...ux.ibm.com>, Hari
Bathini <hbathini@...ux.ibm.com>, Michael Ellerman <mpe@...erman.id.au>,
Thomas Zimmermann <tzimmermann@...e.de>, Andrew Morton
<akpm@...ux-foundation.org>, Baoquan He <bhe@...hat.com>, Yuntao Wang
<ytcoode@...il.com>, David Kaplan <david.kaplan@....com>, Tao Liu
<ltao@...hat.com>, "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Kai Huang <kai.huang@...el.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Breno Leitao <leitao@...ian.org>, Wei Yang <richard.weiyang@...il.com>,
Rong Xu <xur@...gle.com>, Thomas Weißschuh
<thomas.weissschuh@...utronix.de>, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, Simon Horman <horms@...nel.org>, Dave Young
<dyoung@...hat.com>, Peter Zijlstra <peterz@...radead.org>, bsz@...zon.de,
nathan@...nel.org
Subject: Re: [PATCH 8/9] x86/kexec: Cope with relocate_kernel() not being at
the start of the page
On Tue, 2024-12-17 at 10:25 +0100, Ard Biesheuvel wrote:
>
> > > You can still avoid the absolute relocations though, ...
> > ...
> > > > + addq $identity_mapped, %rsi
> > > > + subq $__relocate_kernel_start, %rsi
> > >
> > > ... if you turn this into
> > >
> > > 0: addq $identity_mapped - 0b, %rsi
> > > subq $__relocate_kernel_start - 0b, %rsi
> >
> > Is there any benefit to doing so? Are absolute relocations problematic?
>
> Every absolute relocation produces an entry in the relocation table
> that needs to be applied at every boot when KASLR is in effect. Beyond
> that, it doesn't matter.
>
> I've looked into PIC codegen/PIE linking for the core kernel, which is
> why this caught my eye. If that effort ever advances, I'll need to
> revisit this code as well and apply the change I suggested.
OK, since it looks like I'll be reposting this series once I'm back at
a keyboard for real, I've done that in my tree.
There's one more absolute relocation, for saved_context just before
returning to the kernel from the 'virtual_mapped' code. That's only
reloading the GDT, and we could probably do that from the C code in
machine_kexec().
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists