[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EFI executable corruption when live patching is turned off



On Thursday, August 6, 2020 6:40 PM, Jan Beulich <jbeulich@xxxxxxxx> wrote:

> On 05.08.2020 20:19, Trammell Hudson wrote:
> [...]
> > ~/build/xen-clean/xen$ objcopy xen.efi test.efi
> > objcopy: test.efi: Data Directory size (1c) exceeds space left in section 
> > (18)
> > objcopy: test.efi: error copying private BFD data: file in wrong format
> > ~/build/xen-clean/xen$ objcopy --version | head -1
> > GNU objcopy (GNU Binutils for Ubuntu) 2.34
>
> I've tried to find a sensible way to fix this in objcopy, but could
> come up with only a somewhat hackish variant:
> https://sourceware.org/pipermail/binutils/2020-August/112746.html
> Let's see what the maintainers there think, or if they have better
> suggestions (or are willing to address this themselves). The issue
> is pretty certainly not tied to LIVEPATCH, but rather to how much
> padding space there is at the end of the .rodata section.

Thanks for tracking that down!  I was also almost certain it was not a 
livepatch issue, although that was the easiest minimal test case that I could 
produce.

As a workaround for the Xen project, what do you think of forcing alignment on 
.buildid so that the tool is happy:

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 111edb5..712ffc8 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -161,6 +161,7 @@ SECTIONS
        __note_gnu_build_id_end = .;
   } :note :text
 #elif defined(BUILD_ID_EFI)
+  . = ALIGN(4096);
   DECL_SECTION(.buildid) {
        __note_gnu_build_id_start = .;
        *(.buildid)

--
Trammell



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.