[Bug libdw/28720] UBSan: member access within misaligned address 0x7f6e8d80f142 for type 'struct Elf32_Phdr', which requires 4 byte alignment

2022-01-06 Thread evvers at ya dot ru via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #17 from Evgeny Vereshchagin --- FWIW I tested https://sourceware.org/pipermail/elfutils-devel/2022q1/004637.html as well with gcc (since it isn't reproducible with clang), honggfuzz and the latest OSS-Fuzz corpus. That issue is go

[Bug libdw/28720] UBSan: member access within misaligned address 0x7f6e8d80f142 for type 'struct Elf32_Phdr', which requires 4 byte alignment

2022-01-06 Thread evvers at ya dot ru via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #16 from Evgeny Vereshchagin --- I tested both patches with CFLite, AFL++ and hongfuzz for about ten minutes under ASan/UBSan with the reproducer testcases included in the "seed" corpus. I also unleashed the latest corpus provided

[Bug libdw/28720] UBSan: member access within misaligned address 0x7f6e8d80f142 for type 'struct Elf32_Phdr', which requires 4 byte alignment

2022-01-06 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #15 from Mark Wielaard --- (In reply to Evgeny Vereshchagin from comment #3) > $ UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 > LD_LIBRARY_PATH="./libdw;./libelf" ./src/stack --core > SIGABRT.PC.7fffe4f4e84c.STA

[PATCH] libdwfl: Declare possible zero sized arrays only when non-zero

2022-01-06 Thread Mark Wielaard
The gcc undefined sanitizer complains when seeing a zero sized array declaration. Move the declaration to the point in the code where we know they aren't zero sized. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 + libdwfl/link

[Bug libdw/28720] UBSan: member access within misaligned address 0x7f6e8d80f142 for type 'struct Elf32_Phdr', which requires 4 byte alignment

2022-01-06 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #14 from Mark Wielaard --- (In reply to Evgeny Vereshchagin from comment #3) > $ UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 > LD_LIBRARY_PATH="./libdw;./libelf" ./src/stack --core > SIGABRT.PC.7fffe4f4e84c.STA

[PATCH] libdwfl: Handle unaligned Dyns in dwfl_segment_report_module

2022-01-06 Thread Mark Wielaard
The xlate functions only handle correctly aligned buffers. But they do handle src == dest. So if the source buffer isn't aligned correctly just copy it first into the destination (which is already correctly aligned). https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaa

[Bug libdw/28720] UBSan: member access within misaligned address 0x7f6e8d80f142 for type 'struct Elf32_Phdr', which requires 4 byte alignment

2022-01-06 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #13 from Mark Wielaard --- (In reply to Evgeny Vereshchagin from comment #9) > According to OSS-Fuzz looks like that commit triggered > https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43307 (which was also > reported in > htt

[PATCH] libdwfl: Fix overflow check in link_map.c read_addrs

2022-01-06 Thread Mark Wielaard
The buffer_available overflow check wasn't complete. Also check nb isn't too big. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 4 libdwfl/link_map.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libdwfl