[PATCH v2 04/10] efi/libstub: Capture loaded image information in struct efi_image_info
Jason Gunthorpe
jgg at nvidia.com
Fri Nov 13 11:51:32 PST 2026
On Fri, Nov 13, 2026 at 05:15:29PM +0100, Ard Biesheuvel wrote:
>
> On Fri, 13 Nov 2026, at 16:10, Jason Gunthorpe wrote:
> > You could do the same by passing image_base and image_info everywhere,
> > but that seems less nice.
> >
>
> I'd prefer to handle this by adding another offset, and an API to update
> it after moving the image. That way, the EFI stub code can still grab the
> info struct pointer without threading it through the API, while it will
> always remain valid.
I did draft threading it throughout the API and it was a net
improvement, IMHO. There wasn't much and it removed __weak function
shenanigans because info is always available and you can just always
jump to entry even for zboot.
But yeah, you can adjust the function to return the corrected version
too.
> > The code could consistently use the offset_to_ptr() macro if the label was
> > included in the macro?
> >
> > #define REL_REF(sym) 0: .long sym - 0b
> >
> > It would make the efistub_kernel_ptr() simpler, and the three size
> > calculations would look like:
> >
> > return efistub_kernel_ptr(image_info, __inittext_end) -
> > efistub_kernel_ptr(image_info, _text);
> >
>
> Again, probably cleaner to just refer to the copy of the struct once
> it exists.
Well, we need pointers, like for entry, so as long as there is some
way to get them that always works I'm fine.
Converting directly from image_info without the image_base argument
was convenient..
Jason
More information about the linux-riscv
mailing list