This is the mail archive of the
mailing list for the elfutils project.
find_aux_sym triggers a kernel heuristic
- From: Josh Stone <jistone at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 07 Mar 2014 17:39:28 -0800
- Subject: find_aux_sym triggers a kernel heuristic
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:
134│ mod->e_type = ehdr->e_type;
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.