DynamoRIO / DynamoRIO/dynamorio
ASSERT dcontext == get_thread_private_dcontext() in dr_read_saved_reg is too strong
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
From the users list https://groups.google.com/forum/#!topic/DynamoRIO-Users/Q_aC_MogiGg
> I'm trying to use a tool to extract some data on an MPI application that uses some asynchronous communication, but I'm getting the following error:
>
> parent 0x000000004b449d70, 0x00005574ec406592 report_dynamorio_problem
frame ptr 0x000000004b449d70 => parent 0x000000004b449dc0, 0x00005574ec400e17 external_error
frame ptr 0x000000004b449dc0 => parent 0x000000004b449df0, 0x00005574ec506ac3 dr_read_saved_reg
frame ptr 0x000000004b449df0 => parent 0x000000004b449e20, 0x0000000078002ace get_spilled_value
frame ptr 0x000000004b449e20 => parent 0x000000004b449f70, 0x00000000780064bf drreg_event_restore_state
frame ptr 0x000000004b449f70 => parent 0x000000004b44a1d0, 0x000000007300540a drmgr_restore_state_event
frame ptr 0x000000004b44a1d0 => parent 0x000000004b44a270, 0x00005574ec4fe52e instrument_restore_state
frame ptr 0x000000004b44a270 => parent 0x000000004b44a8b0, 0x00005574ec51120e recreate_app_state_internal
frame ptr 0x000000004b44a8b0 => parent 0x000000004b44a8f0, 0x00005574ec5115e0 recreate_app_state
frame ptr 0x000000004b44a8f0 => parent 0x000000004b44a940, 0x00005574ec4ec421 at_safe_spot
frame ptr 0x000000004b44a940 => parent 0x000000004b44ac60, 0x00005574ec4ed878 synch_with_thread
frame ptr 0x000000004b44ac60 => parent 0x000000004b44ad20, 0x00005574ec4eeee3 synch_with_all_threads
frame ptr 0x000000004b44ad20 => parent 0x000000004b44ada0, 0x00005574ec3d2f47 fcache_reset_all_caches_proactively
frame ptr 0x000000004b44ada0 => parent 0x000000004b44ae30, 0x00005574ec39be72 enter_nolinking
frame ptr 0x000000004b44ae30 => parent 0x000000004b44af20, 0x00005574ec3ea4c2 dispatch_enter_fcache
frame ptr 0x000000004b44af20 => parent 0x000000004b44aff0, 0x00005574ec3e9e47 dispatch
```
That assert is too strong as this is a legitimate use case within DR. There is a similar issue in dr_write_saved_reg.
Contributor guide
Research direction
Start in core/lib/instrument.c around dr_read_saved_reg at the reported assertion, then inspect the related dr_write_saved_reg check. Use the supplied call stack and the internal restore-state path through drreg_event_restore_state and instrument_restore_state to understand the legitimate cross-thread case. Done means these internal paths no longer trigger an overly strong ownership assertion while preserving validation for invalid uses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100