feat(rocprofiler-sdk): validate rocattach pathname lookup by GNU Build ID when device/inode does not match - #9529
Open
mcao59 wants to merge 7 commits into
Open
feat(rocprofiler-sdk): validate rocattach pathname lookup by GNU Build ID when device/inode does not match#9529mcao59 wants to merge 7 commits into
mcao59 wants to merge 7 commits into
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
…mbol lookup fallback path
mcao59
force-pushed
the
users/mcao/attach-container
branch
from
July 30, 2026 23:12
4e7961c to
d53f001
Compare
Contributor
|
Verified this fixes the failure. Same target process, only
|
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
When rocattach resolves a symbol in a target process, it first attempts to open the exact mapped ELF through
/proc/<pid>/map_filesThat path may be unavailable because of kernel configuration or capability restrictions. rocattach then falls back to opening the mapped pathname through
/proc/<pid>/root.In OverlayFS containers, the device and inode reported by
/proc/<pid>/mapscan describe the underlying backing file, while/proc/<pid>/rootopens the overlay-visible file. The two paths may therefore refer to the same ELF content while reporting different device/inode metadata, causing the existing fallback to reject valid container attachment.This change preserves device/inode equality as the fast path and validates a metadata-mismatched
/proc/<pid>/rootfallback by comparing the candidate ELF’s GNU Build ID with the Build ID in the target’s currently mapped image.Technical Details
symbol_lookup.cpp/proc/<pid>/map_fileswith strict device/inode validation as the preferred path./proc/<pid>/root/<mapped-path>whenmap_filesis unavailable.PT_NOTEvalidation to both file and memory reads.symbol_lookup.hppmap_filesand directly exercise the pathname fallback.tests/rocattachIssue Tracking
JIRA ID: ROCM-28593
Test Plan
Added new tests in tests/rocattach
Test Result
New and existing tests pass
Submission Checklist