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

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



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



 


Rackspace

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