BUG: Fix use-after-free in _HelperInputVoidPtr properties#1629
Merged
mdboom merged 4 commits intoNVIDIA:mainfrom Feb 17, 2026
Merged
BUG: Fix use-after-free in _HelperInputVoidPtr properties#1629mdboom merged 4 commits intoNVIDIA:mainfrom
mdboom merged 4 commits intoNVIDIA:mainfrom
Conversation
Contributor
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test |
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
/ok to test |
cpcloud
approved these changes
Feb 17, 2026
|
|
||
| cdef class _InputVoidPtrPtrHelper: | ||
| def __cinit__(self, lst): | ||
| self._references = lst |
Contributor
There was a problem hiding this comment.
Might be worth a comment if possible, so that humans and bots don't think this code is dead code.
mdboom
commented
Feb 17, 2026
Contributor
Author
|
/ok to test |
|
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 12.9.x
git worktree add -d .worktree/backport-1629-to-12.9.x origin/12.9.x
cd .worktree/backport-1629-to-12.9.x
git switch --create backport-1629-to-12.9.x
git cherry-pick -x 0a00e4cb02e2f98d8463aa241346e4e32f5270e4 |
mdboom
added a commit
to mdboom/cuda-python
that referenced
this pull request
Feb 18, 2026
* BUG: Fix use-after-free in _HelperInputVoidPtr properties * Revert cptr ref * Apply suggestion from @mdboom
mdboom
added a commit
that referenced
this pull request
Feb 19, 2026
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.
While working on #1616, I discovered a use-after-free bug in how
void *properties are handled by one of our generators (affecting driver/runtime/nvrtc).If a
void *property value is set to a Python buffer, the reference to that buffer is not held, so if the buffer is independently free'd elsewhere, the pointer becomes dangling. The new unit test here hopefully illustrates the problem.There is a related bug in
_HelperInputVoidPtrPtrthat references to each of the individual buffers are not held so could also get freed early. That bug is less critical since we don't currently use them as properties, only as variables within function calls, so it's actually hard to trigger that bug from the outside. But I thought we should fix it while we are here so it isn't a latent bug if we ever do add support forvoid **properties.