[PATCH v3] arm64/efi: efistub: jump to 'stext' directly, not through the header

Peter Jones pjones at redhat.com
Fri Oct 10 06:53:45 PDT 2014


On Thu, Oct 09, 2014 at 04:20:19PM -0700, Roy Franz wrote:
> I think we'll also run into some alignment issues if the loader really just
> loads the section ( we just have the one) rather than the whole file.
> From reviewing the PE/COFF spec again we violate the relationship
> between FileAlignment and SectionAlignment.

It's hard to pin down exactly whose burden this is - clearly the RVAs
and the File Addresses in the binary are supposed to jive with
SectionAlignment and FileAlignment, respectively, but if they don't,
it's unclear what a loader should do about it.  I've got some (x86)
hardware where LoadImage() rejects the binary entirely in this case, but
the code in tiano doesn't seem to care.  Our loader code in shim ignores
both fields entirely - once we've checked validity in terms of overlap
and boundaries, we happily give sections whatever offset they've
requested.  I suppose on some machines that may mean that a malformed
binary gets a /fault/ pretty quickly.  I'll add checks for those
alignments in shim 0.9 , release date TBD.

So because of that x86 machine that does error out, I've got some
different values here:
https://github.com/vathpela/shim/blob/manual-headers/crt0-efi-x86_64.S#L72
than Ard does in his Aarch64 headers.  There are some other things
wrong on that branch because I didn't understand well enough while
writing some of it - it's basically still there for reference, I don't
anticipate ever shipping it.

-- 
        Peter



More information about the linux-arm-kernel mailing list