Re: [PATCH] libdwfl: Make sure dwfl_elf_phdr_memory_callback returns at least minread

2022-01-03 Thread Mark Wielaard
On Thu, Dec 23, 2021 at 11:19:31PM +0100, Mark Wielaard wrote: > The callers of dwfl_elf_phdr_memory_callback assume at least minread > bytes are read and available. Make sure to check start is smaller than > elf->maximum_size before reading more. Return false if end - start is > smaller than minre

Re: [PATCH] libdwfl: Call xlatetom on aligned buffers in dwfl_link_map_report

2022-01-03 Thread Mark Wielaard
On Fri, Dec 24, 2021 at 01:49:54AM +0100, Mark Wielaard wrote: > Make sure that when calling xlatetom for Phdrs and Dyns in > dwfl_link_map_report the input buffer is correctly aligned by calling > memcpy and setting in.d_buf to out.d_buf. > > https://sourceware.org/bugzilla/show_bug.cgi?id=28720

Re: [PATCH] libdwfl: Calculate addr to read by hand in link_map.c read_addrs.

2022-01-03 Thread Mark Wielaard
On Fri, Dec 24, 2021 at 02:06:08AM +0100, Mark Wielaard wrote: > 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 Pu

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

2022-01-03 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28720 --- Comment #7 from Mark Wielaard --- (In reply to Evgeny Vereshchagin from comment #5) > Created attachment 13875 [details] > File triggering "member access within misaligned address" Thanks. afl++ also found this (but only after 8 days...)