-
Notifications
You must be signed in to change notification settings - Fork 157
Fix dangling pointer problem in _linker.py #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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. |
/ok to test |
This comment has been minimized.
This comment has been minimized.
This doesn't sound correct. The docs state:
This makes it sound like it makes a copy of the From my perspective it sounds like we were just creating a dangling pointer that referenced garbage by the time the |
Looks like we're hitting the second case of here: https://cython.readthedocs.io/en/latest/src/tutorial/strings.html#encoding-text-to-bytes But we found a pattern that the Cython compiler doesn't catch as expected. |
I only shared this on chat before: https://chatgpt.com/share/67d33da7-cc8c-8008-ba5a-1c9ca5614614 This isn't conclusive, but after seeing that I stopped looking further.
That refers specifically to the It is very common that
The temporary Python object only goes out of scope after the BUT Caveat: We can be more certain that my fix is actually working only after QA re-testing succeeds. |
/ok to test |
I'll merge this as-is, so we get this through QA testing tonight (with some luck). I think if I add the release notes in this PR, pushing the commit will mark your approvals as stale. We're missing a couple release notes already, so I'll take care of them all together in another PR. |
|
This code
cuda-python/cuda_core/cuda/core/experimental/_linker.py
Line 408 in f903d98
passes a pointer to a temporary object (for the
name
argument).cuLinkAddData()
documentation for easy reference:cuLinkAddData()
does not make a copy ofconst char* name
, therefore we have to provide a pointer that outlives theCUlinkState
object.