Re: [RFC PATCH 5/6] x86/boot: Move early kernel mapping code into startup/
From: Ard Biesheuvel
Date: Sun Apr 06 2025 - 15:24:33 EST
On Sun, 6 Apr 2025 at 21:51, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>
> * Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
>
> > From: Ard Biesheuvel <ardb@xxxxxxxxxx>
> >
> > The startup code that constructs the kernel virtual mapping runs from
> > the 1:1 mapping of memory itself, and therefore, cannot use absolute
> > symbol references. Move this code into a separate source file under
> > arch/x86/boot/startup/ where all such code will be kept from now on.
> >
> > Since all code here is constructed in a manner that ensures that it
> > tolerates running from the 1:1 mapping of memory, any uses of the
> > RIP_REL_REF() macro can be dropped, along with __head annotations for
> > placing this code in a dedicated startup section.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> > ---
> > arch/x86/boot/startup/Makefile | 2 +-
> > arch/x86/boot/startup/map_kernel.c | 232 ++++++++++++++++++++
> > arch/x86/kernel/head64.c | 228 +------------------
> > 3 files changed, 234 insertions(+), 228 deletions(-)
>
> So this patch breaks the x86-64 allmodconfig build:
>
> ERROR: modpost: "page_offset_base" [arch/x86/crypto/aegis128-aesni.ko] undefined!
> ERROR: modpost: "vmemmap_base" [arch/x86/crypto/aegis128-aesni.ko] undefined!
> ERROR: modpost: "page_offset_base" [arch/x86/crypto/aesni-intel.ko] undefined!
> ERROR: modpost: "vmemmap_base" [arch/x86/crypto/aesni-intel.ko] undefined!
>
> I suppose EXPORT_SYMBOL() in the new startup code isn't properly
> extracted?
>
No, and there is a fundamental issue here, as those exports use
absolute references.
I'll tweak this to keep these definitions in the old location.