-
Notifications
You must be signed in to change notification settings - Fork 260
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Silent Failure
Component
cuda.bindings
Describe the bug
Take a look here:
We are creating a python cudaGraphEdgeData object via a pointer to the underlying C cudaGraphEdgeData struct.
That underlying constructor https://github.com/galv/cuda-python/blob/346afc808db7f7573f9b7a7c2d297868ea7e4894/cuda_bindings/cuda/bindings/runtime.pyx.in#L18241 just saves that pointer, rather doing a deep copy. Thus, it relies upon that underlying pointer staying alive.
Then, cudaGraphGetEdges() immediately frees the underlying pointer that the python objects reference, https://github.com/NVIDIA/cuda-python/blob/346afc808db7f7573f9b7a7c2d297868ea7e4894/cuda_bindings/cuda/bindings/runtime.pyx.in#L35901, and returns the list of python objects which are now backed by dead pointers.
Thus, the cudaGraphEdgeData returned by cudaGraphGetEdges() always suffers a use-after-free. You need to do a deep-copy.
The driver code suffers from the same issue.
Please fix this.
How to Reproduce
I don't think you need a repro to see the problem in this case.
Expected behavior
Do a deep copy of the underlying data.
Operating System
No response
nvidia-smi output
No response