DynamoRIO / DynamoRIO/dynamorio
code_api|client.pcache-use failure on new(er) distributions.
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
**See https://github.com/DynamoRIO/dynamorio/issues/2868**
pcache-use crashes in module_has_text_relocs while looking for the dynamic section pointer in the pcache *app* assuming to be at_map (== true). This happens in the following backtrace
(gdb) bt
#0 module_has_text_relocs (base=0x7f6db1d37000 "\177ELF\002\001\001", at_map=true) at /usr/local/google/home/hgreving/dynamorio/src/core/unix/module_elf.c:1022
#1 0x00007f6db60f4845 in coarse_unit_load (dcontext=0x7f6da1d7f940, start=0x7f6db1d37000 "\177ELF\002\001\001", end=0x7f6db1d3a000 "", for_execution=false) at /usr/local/google/home/hgreving/dynamorio/src/core/perscache.c:3944
#2 0x00007f6db60ed393 in coarse_unit_merge_with_disk (dcontext=0x7f6da1d7f940, info=0x7f6da1e8e920, filename=0x7f6da1dda0f0 "/usr/local/google/home/hgreving/dynamorio/build/bin64/../logs/dpc-603322/client.pcache-dbg-0xeaeb115f.dpc")
at /usr/local/google/home/hgreving/dynamorio/src/core/perscache.c:2578
#3 0x00007f6db60f0958 in coarse_unit_persist (dcontext=0x7f6da1d7f940, info=0x7f6da1e8e920) at /usr/local/google/home/hgreving/dynamorio/src/core/perscache.c:3346
#4 0x00007f6db60cfddb in vm_area_coarse_region_freeze (dcontext=0x7f6da1d7f940, info=0x7f6da1d89220, area=0x7f6da1d87d78, in_place=false) at /usr/local/google/home/hgreving/dynamorio/src/core/vmareas.c:10268
#5 0x00007f6db60d01f6 in vm_area_coarse_units_freeze (in_place=false) at /usr/local/google/home/hgreving/dynamorio/src/core/vmareas.c:10329
#6 0x00007f6db60e4540 in coarse_units_freeze_all (in_place=false) at /usr/local/google/home/hgreving/dynamorio/src/core/perscache.c:548
#7 0x00007f6db60e37fb in perscache_fast_exit () at /usr/local/google/home/hgreving/dynamorio/src/core/perscache.c:437
#8 0x00007f6db5f7e6ea in dynamo_process_exit_with_thread_info () at /usr/local/google/home/hgreving/dynamorio/src/core/dynamo.c:945
#9 0x00007f6db5f7ed8f in dynamo_process_exit_cleanup () at /usr/local/google/home/hgreving/dynamorio/src/core/dynamo.c:1273
#10 0x00007f6db5f7ef69 in dynamo_process_exit () at /usr/local/google/home/hgreving/dynamorio/src/core/dynamo.c:1380
#11 0x00007f6db61b39ff in cat_done_saving_dstack () at /usr/local/google/home/hgreving/dynamorio/src/core/arch/x86/x86.asm:625
#12 0x00007f6db61b3a5e in global_do_syscall_sysenter () at /usr/local/google/home/hgreving/dynamorio/src/core/arch/x86/x86.asm:814
#13 0x00007f6da1ddb000 in ?? ()
#14 0x00007f6da1d7f940 in ?? ()
#15 0x00000000000000e7 in ?? ()
#16 0x0000000000000000 in ?? ()
At this point, at_map should prob. be === false (dynamo_initialized is prob. not enough). The crash happens because the 'dyn' pointer is wrong (see i#2868)
I think the code is usually only called when libraries are freshly mapped (at_map == true)
On new(er) distributions, PIE is default and the app is compiled w/ PIE. Possibly the problem is that we do not support persistent ccache for the app itself? At the very last the 'at_map' logic seems to be wrong when the ELF file to be examined is the app itself with the current logic.
Always compiling the test w/ -no-pie "fixes" the test.
Contributor guide
Assessment
This issue has not been assessed yet.