[Bug libelf/28685] UBSan: member access within misaligned address 0x7ff316818032 for type 'struct Elf32_Phdr'

evvers at ya dot ru sourceware-bugzilla@sourceware.org
Fri Dec 17 09:54:33 GMT 2021


--- Comment #2 from Evgeny Vereshchagin <evvers at ya dot ru> ---
> Should we try to handle unaligned access in the xlateto functions?
> Those functions make use of a lot of tricky macros, which depend on the
> types passed in.
> Or should we fix the called (dwfl_segment_report_module) to only pass
> correctly aligned buffers to the xlateto function?

I think it depends on how libelf is supposed to be used. If callers are
expected to pass correctly aligned buffers it seems dwfl_segment_report_module
should be fixed. But it seems that callers can sometimes assume that it should
be fine to pass unaligned data. For example, (even though it has nothing to do
with the xlateto functions) in one of libbpf issues it was pointed out that "I
don't see anywhere the requirement that bytes passed to the elf_memory() should
be aligned, so this does seem like libelf bug."

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

More information about the Elfutils-devel mailing list