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

Re: [PATCH 2/6] Align all sections to 4KB


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Frediano Ziglio <freddy77@xxxxxxxxx>
  • Date: Thu, 11 Jun 2026 15:49:42 +0100
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=moTCC/8SdmNIwtUxXbsXuDbFrih4JjrEM9T7hJKhFlg=; fh=u9Gugbv7nDZYHETIpcjIyYj9si536uXJFSYjxWXrzIo=; b=gq7v0cBzEStnXbKIejYq8PhRyaF306zp+uwTItccTt4kGnZ1crrCyN1VFNQiFT4laX cx+Z14GhPmDGxHA2bOyYSGO995orY6a+m9FPOOhEhc8p5hTF4U6HFFHdtV6TUdNubKM0 lT7s7775A63IKm0kaYOtXB7YfiOKSFeqSxV4hMXxsDAVBTx/xCY8p9ig/o714YBewHt3 Z+AwwKx9BeaE2rJck8RkrFnfWGCjCi4EQwBC2MSYg1dAu6Ae9EY6XJWz8Vw99vyEbJhu NRv8LxnMuILOxg5juqlXQYxPynaE6FAOFPS1hOXz7z0XvxB5nl9s4nyDptU4gQw+gIZi GfFQ==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1781189395; cv=none; d=google.com; s=arc-20240605; b=hrVpRMJrKeSqB1cOyZCEGX6jaUK+dPHEBi7ik7XEeVz5awXZxu89tdhdd2NWFpoNTv XZhdznk3yGKvBgEqruFjGZBPLPfFTSGmWtc9gLk13GbzALrU1R8SDZ03NUmeeFfsw4kC 00UBAUb4+dKXhfIIwB442dcORpGEHUChHIdkm70WKeILAhyhczB++cfNcSRnCWxv39lf hVwJVNgCtaEaMpmVhbC/gqwisvBf6CGz4FiM+7GTdqMx0WF9MQICX3TiP7yd7Wl/hfJp NS4sxrPU4PcIIduaNAjvuH+DtZpTZGvjkuX8w6gieNNUEDePxCwuBQYZ/4NqM8I9WgRj /i9g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 11 Jun 2026 14:50:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, 10 Jun 2026 at 10:43, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 06.06.2026 18:02, Frediano Ziglio wrote:
> > Frediano
> >
> > On Fri, 5 Jun 2026 at 08:45, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> >>
> >> On 04.06.2026 12:16, Frediano Ziglio wrote:
> >>> On Tue, 2 Jun 2026 at 13:09, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> >>>> On 29.05.2026 17:35, Frediano Ziglio wrote:
> >>>>> --- a/xen/arch/x86/xen.lds.S
> >>>>> +++ b/xen/arch/x86/xen.lds.S
> >>>>> @@ -162,8 +162,8 @@ SECTIONS
> >>>>>         __note_gnu_build_id_end = .;
> >>>>>    } PHDR(note) PHDR(text)
> >>>>>  #elif defined(BUILD_ID_EFI)
> >>>>> -  /* Workaround bug in binutils < 2.36 */
> >>>>> -  . = ALIGN(32);
> >>>>> +  /* align to satisfy UEFI CA memory mitigation */
> >>>>> +  . = ALIGN(PAGE_SIZE);
> >>>>>    DECL_SECTION(.buildid) {
> >>>>>         __note_gnu_build_id_start = .;
> >>>>>         *(.buildid)
> >>>>> @@ -330,6 +330,7 @@ SECTIONS
> >>>>>    __2M_rwdata_end = ALIGN(SECTION_ALIGN);
> >>>>>
> >>>>>  #ifdef EFI
> >>>>> +  . = ALIGN(PAGE_SIZE);
> >>>>>    .reloc ALIGN(4) : {
> >>>>>      __base_relocs_start = .;
> >>>>>      *(.reloc)
> >>>>> @@ -355,6 +356,7 @@ SECTIONS
> >>>>>    VIRT_START &= 0;
> >>>>>    ALT_START &= 0;
> >>>>>
> >>>>> +  . = ALIGN(PAGE_SIZE);
> >>>>>    .sbat (NOLOAD) : { *(.sbat) }
> >>>>>  #elif defined(XEN_BUILD_EFI)
> >>>>>    /*
> >>>>
> >>>> You say "all sections" in the title, yet this is not covering e.g. debug
> >>>> info.
> >>>
> >>> I will change to "all loadable sections". debug sections are not
> >>> loadable so they don't cause an issue.
> >>
> >> Please try to be precise there, as some aspects are subtle. As per my
> >> understanding, like .reloc all .debug_* are loadable (and may be loaded).
> >> The IMAGE_SCN_MEM_DISCARDABLE flag merely means they can be discarded at
> >> a certain point after image loading (for .reloc in particular: after
> >> relocations were processed).
> >
> > No, debug sections are not loadable, for instance, in a random
> > executable I found:
> >
> > Sections:
> > Idx Name          Size      VMA               LMA               File off  
> > Algn
> >   0 .text         0000c7f8  0000000140001000  0000000140001000  00000600  
> > 2**4
> >                   CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
> >   1 .data         00000250  000000014000e000  000000014000e000  0000ce00  
> > 2**4
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   2 .rdata        00002c70  000000014000f000  000000014000f000  0000d200  
> > 2**4
> >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> >   3 .pdata        00000654  0000000140012000  0000000140012000  00010000  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> >   4 .xdata        00000630  0000000140013000  0000000140013000  00010800  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> >   5 .bss          00001ec0  0000000140014000  0000000140014000  00000000  
> > 2**4
> >                   ALLOC
> >   6 .idata        00000c88  0000000140016000  0000000140016000  00011000  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   7 .CRT          00000060  0000000140017000  0000000140017000  00011e00  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   8 .tls          00000010  0000000140018000  0000000140018000  00012000  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   9 .reloc        0000009c  0000000140019000  0000000140019000  00012200  
> > 2**2
> >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> >  10 .debug_aranges 00000150  000000014001a000  000000014001a000  00012400  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  11 .debug_info   0000d5e4  000000014001b000  000000014001b000  00012600  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  12 .debug_abbrev 000014de  0000000140029000  0000000140029000  0001fc00  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  13 .debug_line   00001a36  000000014002b000  000000014002b000  00021200  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  14 .debug_frame  00000f40  000000014002d000  000000014002d000  00022e00  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  15 .debug_str    000003a0  000000014002e000  000000014002e000  00023e00  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  16 .debug_line_str 00000a76  000000014002f000  000000014002f000  00024200  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  17 .debug_loclists 0000174a  0000000140030000  0000000140030000  00024e00  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
> >  18 .debug_rnglists 0000039c  0000000140032000  0000000140032000  00026600  
> > 2**0
> >                   CONTENTS, READONLY, DEBUGGING
>
> That's derived from libfd's internal representation, which means nothing at
> all to the loader processing the image. If your objdump is suitably enabled,
> try using its -P option.
>
> Jan

You are right, I got

Section headers (at offset 0x00000188):
 # Name     paddr    vaddr    size     scnptr   relptr   lnnoptr   nrel nlnno
 1 .text    0000c7f8 00001000 0000c800 00000600 00000000 00000000     0     0
            Flags: 60000060: EXECUTE,READ,CODE,INITIALIZED DATA
 2 .data    00000250 0000e000 00000400 0000ce00 00000000 00000000     0     0
            Flags: c0000040: READ,WRITE,INITIALIZED DATA
 3 .rdata   00002c70 0000f000 00002e00 0000d200 00000000 00000000     0     0
            Flags: 40000040: READ,INITIALIZED DATA
 4 .pdata   00000654 00012000 00000800 00010000 00000000 00000000     0     0
            Flags: 40000040: READ,INITIALIZED DATA
 5 .xdata   00000630 00013000 00000800 00010800 00000000 00000000     0     0
            Flags: 40000040: READ,INITIALIZED DATA
 6 .bss     00001ec0 00014000 00000000 00000000 00000000 00000000     0     0
            Flags: c0000080: READ,WRITE,UNINITIALIZED DATA
 7 .idata   00000c88 00016000 00000e00 00011000 00000000 00000000     0     0
            Flags: c0000040: READ,WRITE,INITIALIZED DATA
 8 .CRT     00000060 00017000 00000200 00011e00 00000000 00000000     0     0
            Flags: c0000040: READ,WRITE,INITIALIZED DATA
 9 .tls     00000010 00018000 00000200 00012000 00000000 00000000     0     0
            Flags: c0000040: READ,WRITE,INITIALIZED DATA
10 .reloc   0000009c 00019000 00000200 00012200 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
11 /4       00000150 0001a000 00000200 00012400 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
12 /19      0000d5e4 0001b000 0000d600 00012600 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
13 /31      000014de 00029000 00001600 0001fc00 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
14 /45      00001a36 0002b000 00001c00 00021200 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
15 /57      00000f40 0002d000 00001000 00022e00 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
16 /70      000003a0 0002e000 00000400 00023e00 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
17 /81      00000a76 0002f000 00000c00 00024200 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
18 /97      0000174a 00030000 00001800 00024e00 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA
19 /113     0000039c 00032000 00000400 00026600 00000000 00000000     0     0
            Flags: 42000040: DISCARDABLE,READ,INITIALIZED DATA

I suppose I will change to simply "Align some sections to 4KB"

Frediano



 


Rackspace

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