find_aux_sym triggers a kernel heuristic
Josh Stone
jistone at redhat.com
Sat Mar 8 01:39:28 UTC 2014
Please see: https://sourceware.org/bugzilla/show_bug.cgi?id=16676#c2
I'm using elfutils-0.158-1.fc20.x86_64, but I don't think git libdwfl
has changed in any relevant way since then.
The gist is that I have an ET_EXEC binary, /usr/bin/ls. When I call
dwfl_module_getsymtab -> find_symtab -> find_aux_sym -> open_elf, the
following heuristic is triggered:
libdwfl/dwfl_module_getdwarf.c
134│ mod->e_type = ehdr->e_type;
135│
136│ /* Relocatable Linux kernels are ET_EXEC but act like ET_DYN. */
137│ if (mod->e_type == ET_EXEC && file->vaddr != mod->low_addr)
138├> mod->e_type = ET_DYN;
Here file->vaddr = 0x400020 and mod->low_addr = 0x400000, but this
certainly is not a kernel, and should not be treated as ET_DYN.
Maybe this only needs to add a check that file == &mod->main, but I
wonder if this heuristic is even needed at all, because report_kernel()
forcibly sets ET_DYN itself.
Thoughts?
Josh
More information about the elfutils-devel
mailing list