jlinton / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

8ffa553 arm64/loader: Tweak the loaded kernel size to correct BSS

Authored and Committed by jlinton 2 years ago
    arm64/loader: Tweak the loaded kernel size to correct BSS
    
    The arm64 grub loader code has diverged significantly from the
    upstream grub code which uses boot services to load and start
    the efi stubbed kernel.
    
    This by itself is a bit of a problem, but the larger problem
    is that the RH/grub implementation is very simplistic and doesn't
    parse much of the PE/COFF header and place the segments in memory
    as the PE sections dictate. Instead there is a rough assumption
    that the filesize = text+data and that the difference between that
    and the imagesize in the header is BSS. And this fails if the
    raw size != virtual size, or there is additional file padding,
    etc.
    
    So, we have been getting away with this, until the efi stub
    decompressor patches, currently posted wrap a compressed/signed
    EFI + kernel image with a stub decompressor and a signature.
    
    In that case the BSS data isn't all being cleared properly, so
    further hack this up a bit and compute the on disk data size
    from the section data info rather than its actual disk size.
    
    Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
    
        
file modified
+2 -0