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

mark at klomp dot org sourceware-bugzilla@sourceware.org
Tue Jan 4 21:37:53 GMT 2022


https://sourceware.org/bugzilla/show_bug.cgi?id=28720

--- Comment #10 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Evgeny Vereshchagin from comment #8)
> (In reply to Mark Wielaard from comment #7)
> > commit 9f70a762ab88ceebb8a48a7c9c3ce39ff7f205af
> > Author: Mark Wielaard <mark@klomp.org>
> > Date:   Fri Dec 24 02:01:32 2021 +0100
> > 
> >     libdwfl: Calculate addr to read by hand in link_map.c read_addrs.
> >     
> >     The gcc undefined sanitizer doesn't like the trick we use to calculate
> >     the (possibly) unaligned addresses to read. So calculate them by hand
> >     as unsigned char pointers.
> >     
> >     https://sourceware.org/bugzilla/show_bug.cgi?id=28720
> >     
> >     Signed-off-by: Mark Wielaard <mark@klomp.org>
> > 
> > Which should this particular issue.
> 
> 
> I'm not sure but it seems it can still be triggered with that commit applied:
> ```
> $ git log --oneline -5
> 9f70a762 (HEAD -> master, origin/master, origin/HEAD) libdwfl: Calculate
> addr to read by hand in link_map.c read_addrs.
> 5b490793 libdwfl: Call xlatetom on aligned buffers in dwfl_link_map_report
> 1cf73965 libdwfl: Make sure dwfl_elf_phdr_memory_callback returns at least
> minread
> 4fdd8588 libdwfl: Always clean up build_id.memory
> 8f8c78cc libdwfl: Handle unaligned Nhdr in dwfl_segment_report_module
> 
> $ autoreconf -i -f
> $ ./configure --enable-maintainer-mode --enable-sanitize-undefined
> $ make -j$(nproc) V=1
> 
> $ UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1
> LD_LIBRARY_PATH="./libdw;./libelf" ./src/stack --core
> ./attachment.cgi\?id\=13875
> gelf_xlate.h:48:1: runtime error: member access within misaligned address
> 0x7f5cd5612077 for type 'struct Elf32_Dyn', which requires 4 byte alignment

That is a different issue than the one reported in comment #5.
This bug might be split up for the different issues found.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list