cuda.core: validate accessed_by kinds before cuMemAdvise (Glasswing V19.1)#2222
Merged
Andy-Jost merged 1 commit intoJun 15, 2026
Merged
Conversation
Dry-run location-kind checks in the ManagedBuffer.accessed_by setter so bulk assignment cannot partially mutate driver state when an invalid Host NUMA variant appears in the target set (Glasswing V19.1).
This comment has been minimized.
This comment has been minimized.
mdboom
approved these changes
Jun 15, 2026
| target.add(loc) | ||
| for loc in target: | ||
| spec = _coerce_location(loc) | ||
| assert spec is not None |
Contributor
There was a problem hiding this comment.
Will Glasswing complain that this goes away in -O mode (as it did in another issue)?
Contributor
Author
There was a problem hiding this comment.
It appears that Glasswing only flags issues when it can put together a trace that involves crossing a security boundary, so it won't flag every use of assert.
In the other issue (cuda-python-private#382 -- Glasswing V3.2, NVBUG 6268893), it flagged that assert because the data it checked came in through pickle and was therefore untrusted.
|
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.
Summary
Addresses Glasswing finding V19.1 (NVBUG 6268913): the
ManagedBuffer.accessed_bysetter validated element types up front but deferred location-kind checks to_advise_oneinside the update loop. A bulk assignment containing an invalid kind (e.g.Host(numa_id=...), which maps tohost_numa) could unset valid entries before raising, leaving torn driver state.Changes
cuda_core/cuda/core/_memory/_managed_buffer.py: dry-run_coerce_locationand reject unsupported kinds forCU_MEM_ADVISE_SET_ACCESSED_BYbefore anycuMemAdvisecallscuda_core/tests/memory/test_managed_ops.py: addtest_accessed_by_set_assignment_validates_kind_before_mutationTest Coverage
test_accessed_by_set_assignment_validates_kind_before_mutation— invalid bulk assignment raises without removing previously appliedaccessed_byentriesRelated Work