-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix missing GC root in Symbol construction #47865
Conversation
The `Symbol` constructor in boot.jl was not using the unsafe_convert mechanism, becuase it is unavailable at this point in bootstrap. However, it was also not GC-rooting the string some other way, resulting in potential memory corruption. Fix that by manually inlining the :foreigncall and setting up the root appropriately.
SGTM. Though I wonder if we shouldn't just duplicate the code, since the random |
I did it that way at first, but then I wanted to minimize the number of manually written |
That is also true. I guess I also like to minimize the number of APIs that take naked Ptr to ccall something from them, but this PR is fine |
This segfaults when backporting to 1.8 when making
|
The `Symbol` constructor in boot.jl was not using the unsafe_convert mechanism, becuase it is unavailable at this point in bootstrap. However, it was also not GC-rooting the string some other way, resulting in potential memory corruption. Fix that by manually inlining the :foreigncall and setting up the root appropriately. (cherry picked from commit b5a6b0f)
The
Symbol
constructor in boot.jl was not using the unsafe_convert mechanism, becuase it is unavailable at this point in bootstrap. However, it was also not GC-rooting the string some other way, resulting in potential memory corruption. Fix that by manually inlining the :foreigncall and setting up the root appropriately.