On Thu, Dec 22, 2022 at 04:24:11PM +0100, Lennart Poettering wrote: > On Do, 22.12.22 14:49, Daniel P. Berrangé (berrange@xxxxxxxxxx) wrote: > > > When you say it dooesn't get the offsets right, can you elaborate ? > > dracut uses fixed offsets for the sections to be placed in memory > in. The values are simply hardcoded, literally specified address > offsets, that worked for the original authors. This typically works – > as long as your sections are not much larger than they were for the > people wo came up with these offsets initially. But as it turns out > this doesn't work for some cases. In such cases the sections will be > loaded into memory overlapped and bad things happen. > > ukify hence calculates the offsets manually (by adding up the section > sizes so that this cannot happen. The issue was detected in CI [1]. Some code changes made the .text section bigger, causing other sections to overlap, causing an actual failure during boot. But it seems that the problem is more widespread and we were just being lucky ;( We're figuring out the details, See the attached program: $ dracut --uefi /tmp/initrd 6.0.13-300.fc37.x86_64 $ python info.py /tmp/initrd ... # 4 .rela 000010c8 000000000001f000 000000000001f000 00017f40 2**2 start=126976 end=131272 # 5 .osrel 000002df 0000000000020000 0000000000020000 00019140 2**2 start=131072 end=131807 vma overlap with previous section: 200 bytes ... I plan to return to this after the holidays. Zbyszek [1] https://github.com/systemd/systemd/pull/23706#issuecomment-1354729112
'''\ Idx Name Size VMA LMA File off Algn 0 .text 00013aa0 0000000000005000 0000000000005000 00000370 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .reloc 0000000a 0000000000019000 0000000000019000 00013f70 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .data 000051a8 000000000001a000 000000000001a000 00014170 2**4 CONTENTS, ALLOC, LOAD, DATA 3 .dynamic 00000100 0000000000020000 0000000000020000 00019370 2**2 CONTENTS, ALLOC, LOAD, DATA 4 .osrel 0000029c 0000000000020000 0000000000020000 00019570 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 5 .rela 000014e8 0000000000021000 0000000000021000 00019970 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .dynsym 00000018 0000000000023000 0000000000023000 0001af70 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 7 .sbat 000000d5 0000000000025980 0000000000025980 0001b170 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 8 .sdmagic 00000027 0000000000025a60 0000000000025a60 0001b370 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 9 .cmdline 00000032 0000000000030000 0000000000030000 0001b570 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 10 .linux 00c285e8 0000000002000000 0000000002000000 0001b770 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 11 .initrd 038a76ee 0000000003000000 0000000003000000 00c43d70 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA ''' import subprocess import sys dump = subprocess.check_output(['objdump', '-h', sys.argv[1]], text=True) prev = None print(dump) for line in dump.splitlines()[5::2]: print(f'# {line}') idx, name, size, vma, lma, file_off, align = line.split() idx = int(idx) size = int(size, 16) vma = int(vma, 16) lma = int(lma, 16) file_off = int(file_off, 16) align = eval(align) print(f' start={vma} end={vma + size}') if prev: gap = file_off - prev[5] - prev[2] if gap < 0: print(f' file offset overlap with previous section: {-gap} bytes') gap = vma - prev[3] - prev[2] if gap < 0: print(f' vma overlap with previous section: {-gap} bytes') prev = (idx, name, size, vma, lma, file_off, align)
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue