Bug 1130781
Summary: | Symbols of deleted libraries do not resolve | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jan Kratochvil <jan.kratochvil> |
Component: | elfutils | Assignee: | Jan Kratochvil <jan.kratochvil> |
Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | aoliva, fche, jakub, jan.kratochvil, mjw, mjw, pmachata, roland |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-08-29 21:06:21 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jan Kratochvil
2014-08-17 17:04:23 UTC
Thanks for the testcase. It does show things work for unwinding, the "deleted" ELF image is recovered through elf_from_remote_memory and the .eh_frame is found causing the unwinder to go through the "deleted" module. But it doesn't handle address/function name resolving. That isn't too surprising. elf_from_remote_memory is conservative and probably only retrieved the memory mapped regions of the ELF image. In your example I saw elf_from_remote_memory explicitly clears the shdrs from the image. Which makes the symtab symbols unreachable. But since your elf_begin_at_offset seems to be able to provide them it might be that elf_from_remote_memory is too conservative and could be fixed to map in more of the ELF image to make not just unwinding but also addr/function name resolving work. The best approach is probably to trace which parts of the "deleted .so" are actually mmaped in (maybe use /proc/PID/maps) and match them with the regions that elf_from_remote_memory picked up from the PT_LOAD map. Note there are still some open issues with the patches your propose as discussed on the list: https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-February/003836.html https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-February/003838.html https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-March/003865.html https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-March/003863.html (In reply to Mark Wielaard from comment #1) > Thanks for the testcase. The testcase was already part of the original posting (although it had a bug): [patch 3/3] Access deleted files by /dev/PID/mem > That isn't too surprising. elf_from_remote_memory is conservative and > probably only retrieved the memory mapped regions of the ELF image. In your > example I saw elf_from_remote_memory explicitly clears the shdrs from the > image. Which makes the symtab symbols unreachable. All the needed symbols are in memory mapped .dynsym, that is intentional by the testcase: deleted_lib_so_LDFLAGS = -shared -rdynamic (In reply to Jan Kratochvil from comment #2) > (In reply to Mark Wielaard from comment #1) > > That isn't too surprising. elf_from_remote_memory is conservative and > > probably only retrieved the memory mapped regions of the ELF image. In your > > example I saw elf_from_remote_memory explicitly clears the shdrs from the > > image. Which makes the symtab symbols unreachable. > > All the needed symbols are in memory mapped .dynsym, that is intentional by > the testcase: > deleted_lib_so_LDFLAGS = -shared -rdynamic In that case they should be found through the phdrs in libdwfl/dwfl_module_getdwarf.c (find_dynsym). But apparently they are not in your testcase. I think the issue is that find_dynsym calls find_offsets which translates the addresses into offsets, but seems to get things wrong with the in-memory ELF image phdrs. [patch] Fix resolving ELF symbols for live PIDs with deleted files https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-August/004121.html |