1 Commits

Author SHA1 Message Date
Chenxi Mao
c2c2e8be79 Fix AArch64 PE section address overlap issue
After 31c209ebf59 delivered, MokManager.efi has below error during shim invoked:
[Bds]Booting suse-secureboot
Loading driver at 0x0002FDBF000 EntryPoint=0x0002FDDD000
2 sections contain entry point
Failed to load image: Unsupported
Failed to start MokManager: Unsupported

The root cause is the AArch64 PE section address overlapped.
Sections
================================================================================
Name      RWX  VirtSize   VirtAddr   RawAddr   RawSize   Entropy  md5
/4        R--  0x16c34    0x5000     0x400     0x17c00     4.84 bdfa950df3517b30bc1ba386b19b322b
.text     R-X  0x5c88c    0x1c000    0x18000   0x5d000     6.32 b52855acbce7b2ea150c30bc4186898d

Reason:
The 0x5000 + 0x17c00 is lager than 0x1c000 which is an unsupported/illegal format.

To fix this issue, there are 3 patches need to be applied from upstream:
d91c67e8730 Re: Add support for AArch64 EFI (efi-*-aarch64)
32384aa396e Re: AArch64: Add support for AArch64 EFI (efi-*-aarch64)
5bb067dba don't over-align file positions of PE executable sections

After above changes, the PE section address are correct.

Sections
================================================================================
Name      RWX  VirtSize   VirtAddr   RawAddr   RawSize   Entropy  md5
/4        R--  0x16c34    0x5000     0x400     0x16e00     4.97 4facea77c0e1db16428ec65d790b13e3
.text     R-X  0x5c88c    0x1c000    0x17200   0x5ca00     6.34 107cbdfa866047ff7a0463c71bbd2745

References: bsn#351
Change-Id: I2e4563b129e30ff55f2146526fc37776dcaf40dc
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
2022-10-08 09:55:16 +08:00