DynamoRIO / DynamoRIO/dynamorio
drmemtrace non-inlined trace-delay instruction counting is racy
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
drmemtrace's -trace_after_instrs feature for 32-bit x86 and 32-bit arm does not inlined the counter increment and has a clean call that does a simple increment of a global variable that is not marked as std::atomic or anything. There is no comment about this: I could imagine deliberately living with the races perhaps on x86, but on weaker-memory-model arm it feels like it's possible to be waay off for small values with just a few threads.
We could stick a std::atomic on the global, or take the effort to inline for these 32-bit arches. If we're going to lose accuracy we may as well do the per-thread counting from #5026.
Contributor guide
Research direction
Locate drmemtrace's -trace_after_instrs implementation for 32-bit x86 and 32-bit ARM, then inspect the clean call and global counter described in the issue. Compare the possible atomic, inlined, or per-thread approaches, including the direction referenced by #5026. Done means the counter no longer has the reported race and counting behavior is validated for these architectures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100