On 18/03/2025 5:35 pm, Roger Pau Monne wrote: > mkelf32 attempt to check that the program header defined NOTE segment falls > inside of the LOAD segment, as the build-id should be loaded for Xen at > runtime to check. > > However the current code doesn't take into account the LOAD program header > segment offset when calculating overlap with the NOTE segment. This > results in incorrect detection, and the following build error: > > arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \ > `nm xen-syms | sed -ne 's/^\([^ ]*\) . > __2M_rwdata_end$/0x\1/p'` > Expected .note section within .text section! > Offset 4244776 not within 2910364! > > When xen-syms has the following program headers: > > Program Header: > LOAD off 0x0000000000200000 vaddr 0xffff82d040200000 paddr > 0x0000000000200000 align 2**21 > filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx > NOTE off 0x000000000040c528 vaddr 0xffff82d04040c528 paddr > 0x000000000040c528 align 2**2 > filesz 0x0000000000000024 memsz 0x0000000000000024 flags r-- > > Account for the program header offset of the LOAD segment when checking > whether the NOTE segments is contained within. > > Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids') > Signed-off-by: Roger Pau Monné <roger....@citrix.com>
Acked-by: Andrew Cooper <andrew.coop...@citrix.com>