fix(dyninst): Fix use-after-unmap from filename-keyed DwarfHandle cache - #29
Open
kcossett-amd wants to merge 1 commit into
Open
fix(dyninst): Fix use-after-unmap from filename-keyed DwarfHandle cache#29kcossett-amd wants to merge 1 commit into
kcossett-amd wants to merge 1 commit into
Conversation
1 task
Author
|
ROCm/rocm-systems#10255 (comment) |
There was a problem hiding this comment.
Pull request overview
Fixes a use-after-unmap hazard in Dyninst’s DWARF handling by preventing DwarfHandle reuse when a filename-cache hit refers to a handle built from a different Elf_X instance than the one currently being parsed.
Changes:
- Validate cached
DwarfHandleentries by comparingorigFile()against the incomingElf_X*. - Evict filename-cache entries that don’t match the current
Elf_Xto force rebuilding a fresh handle.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sputhala-amd
approved these changes
Aug 19, 2026
sputhala-amd
left a comment
There was a problem hiding this comment.
Once this fix is merged, is the plan to revert ROCm/rocm-systems#10171?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
For background on the issue being fixed, see ROCm/rocm-systems#10171
The problem is that the
DwarfHandlecache is keyed only on filename, so it hands back a handle bound to anElf_Xwhose image~Symtabalready unmapped; this verifies the binding and rebuilds the entry when it differs.Technical Details
Reuse a cached
DwarfHandleonly when itsorigFile()matches theElf_Xbeing passed in, otherwise drop the stale entry and build a new handle.Test Plan
ROCm/rocm-systems#10255 (comment)
Test Result
See Test PR on rocprofiler-systems, all tests pass.
Submission Checklist