Repository navigation
fix(rocr): guard handle aperture allocation against a null manager - #13084
Conversation
Heap initialisation tolerates a failed handle aperture reservation by logging a warning and continuing, which leaves the handle aperture manager unset. The allocate and free helpers dereference that manager unconditionally, so a tolerated initialisation failure turns into a null dereference inside the VA manager at the first use. Return the existing out-of-handle-aperture error when the manager was never constructed, and make the free path a no-op in that case. This matches the guard already used on the system heap path in the same file. Reachable on the WSL DXG path from the physical-handle branch of GPU memory initialisation and from the matching free. Configurations where the reservation succeeds are unaffected, since the new branch is taken only in a state that is otherwise undefined behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
There was a problem hiding this comment.
🔵 Needs a closer look
The affected DXG path remains uncompiled and untested, requiring validation in a supported environment.
0 open findings
What changed in this PR
Prevents null-manager dereferences in ROCr’s WSL DXG handle-aperture path after a tolerated initialization failure.
Changes:
- Returns
OutOfHandleApeMemoryand clears the output address when the manager is absent. - Makes freeing a handle-aperture address a no-op when the manager is absent.
| File | Description |
|---|---|
| projects/rocr-runtime/libhsakmt/src/dxg/openclose.cpp | Adds null guards to handle-aperture allocation and freeing. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
Follow-up from I set up a local ROCr build to try to close this gap and confirmed the path That means validation needs a Windows or WSL DXG build specifically. I do not For contrast, and so the difference in confidence is visible: the companion |
TheRock Submodule Bump ActivityNewest first
|
JIRA ID : ROCM-30547
NOTE ON PROVENANCE AND STATUS, PLEASE READ FIRST
This change was generated by an AI triage agent (ROCR_TRIAGE_AGENT) and is
UNTESTED. It has not been compiled and it has not been run. I do not have a
WSL DXG target available, so I could not build the affected path at all.
It is posted because the defect analysis is solid and the fix is a two-branch
null guard that mirrors a guard already merged a few lines away in the same
file, so it is likely the right solution and is cheap for an owner who can
build this path to confirm. Please treat it as a reviewed-by-nobody starting
point rather than a validated change. If it is easier for you to write it
yourself from the analysis below, please do that and close this.
THE DEFECT
Heap initialisation tolerates a failed handle aperture reservation. It logs a
warning and continues, which leaves
handle_aperture_mgr_null.HandleApertureAllocandHandleApertureFreethen dereference that managerunconditionally. A tolerated initialisation failure therefore turns into a
null dereference inside the VA manager at the first use, faulting at the
min_align_member, which sits at offset 0x60 behind the two map members.This is the same class of defect that was fixed for the system heap path. That
fix added the equivalent null guards to
ReserveIPCSysMemandFreeIPCSysMemafter a null
system_heap_mgr_was found to fault at the same offset under aconstrained address space. The handle aperture path has the identical
tolerate-then-dereference shape and was not covered by that change.
THE CHANGE
Return the existing
OutOfHandleApeMemoryerror when the manager was neverconstructed, and make the free path a no-op in that case. The style
deliberately matches the already-merged guards on the system heap path in the
same file.
REACHABILITY
Reachable on the WSL DXG path from the physical-handle branch of GPU memory
initialisation and from the matching free path.
BLAST RADIUS
None for working configurations. The new branch is taken only when the manager
was never constructed, which is undefined behaviour today, and the error
returned is the one callers already handle for the exhausted case.
WHAT A REVIEWER SHOULD CHECK, since I could not
OutOfHandleApeMemoryis the right code for never-constructed asopposed to exhausted, or whether a distinct code is preferred.
propagate the failure instead of swallowing it. That is a separate and
larger change, and is an open ask on the linked ticket. This guard is
defence in depth and does not substitute for it.
🤖 Generated with Claude Code