[Bug libelf/31225] Crash when using elf_memory() on a compressed section; fixed with s/ELF_C_READ/ELF_C_READ_MMAP/

bruening at google dot com sourceware-bugzilla@sourceware.org
Tue Jan 23 22:36:52 GMT 2024


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

--- Comment #2 from Derek Bruening <bruening at google dot com> ---
Our usage is inside a large complex code base that mmaps the file on its own. 
It seems that any use of elf_memory() that has mapped the file on their own as
read-only will hit this.

I know it may not be easy to read random code inside our code base but FTR
elf_memory is called here:
https://github.com/DynamoRIO/dynamorio/blob/master/ext/drsyms/drsyms_elf.c#L283

This is our own code which maps the file (this is pre-existing code that worked
with the libelf from elftoolchain):
https://github.com/DynamoRIO/dynamorio/blob/master/ext/drsyms/drsyms_unix_common.c#L134

It looks like we are passing MAP_PRIVATE, so we may be able to change our
mapping to include write privileges (as copy-on-write): is that what elfutils
expects?  I had thought with the ELF_C_READ_MMAP support elfutils deliberately
supported read-only mappings in general?

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


More information about the Elfutils-devel mailing list