-
Notifications
You must be signed in to change notification settings - Fork 3.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
[Go] Possible to confuse Go GC via C Data Interface #36669
Comments
lidavidm
added a commit
to lidavidm/arrow
that referenced
this issue
Jul 13, 2023
lidavidm
added a commit
to lidavidm/arrow
that referenced
this issue
Jul 13, 2023
lidavidm
added a commit
to lidavidm/arrow
that referenced
this issue
Jul 13, 2023
lidavidm
added a commit
to lidavidm/arrow
that referenced
this issue
Jul 13, 2023
lidavidm
added a commit
to lidavidm/arrow
that referenced
this issue
Jul 13, 2023
lidavidm
added a commit
that referenced
this issue
Jul 13, 2023
### Rationale for this change Prevent hard to debug crashes when using Go code with other code via C Data Interface. ### What changes are included in this PR? In the C Stream Interface implementation, jump through a trampoline that zeroes the out parameters before letting Go see them. Note that this can only guard against the issue when the C Stream Interface is used. Also, fix other issues in the C Data Interface tests with invalid pointers and uninitialized memory that were turned up by the new test here (because it calls `runtime.GC` very frequently). ### Are these changes tested? Yes ### Are there any user-facing changes? No **This PR contains a "Critical Fix".** * Closes: #36669 Lead-authored-by: David Li <[email protected]> Co-authored-by: Matt Topol <[email protected]> Signed-off-by: David Li <[email protected]>
raulcd
pushed a commit
that referenced
this issue
Jul 18, 2023
### Rationale for this change Prevent hard to debug crashes when using Go code with other code via C Data Interface. ### What changes are included in this PR? In the C Stream Interface implementation, jump through a trampoline that zeroes the out parameters before letting Go see them. Note that this can only guard against the issue when the C Stream Interface is used. Also, fix other issues in the C Data Interface tests with invalid pointers and uninitialized memory that were turned up by the new test here (because it calls `runtime.GC` very frequently). ### Are these changes tested? Yes ### Are there any user-facing changes? No **This PR contains a "Critical Fix".** * Closes: #36669 Lead-authored-by: David Li <[email protected]> Co-authored-by: Matt Topol <[email protected]> Signed-off-by: David Li <[email protected]>
chelseajonesr
pushed a commit
to chelseajonesr/arrow
that referenced
this issue
Jul 20, 2023
…he#36670) ### Rationale for this change Prevent hard to debug crashes when using Go code with other code via C Data Interface. ### What changes are included in this PR? In the C Stream Interface implementation, jump through a trampoline that zeroes the out parameters before letting Go see them. Note that this can only guard against the issue when the C Stream Interface is used. Also, fix other issues in the C Data Interface tests with invalid pointers and uninitialized memory that were turned up by the new test here (because it calls `runtime.GC` very frequently). ### Are these changes tested? Yes ### Are there any user-facing changes? No **This PR contains a "Critical Fix".** * Closes: apache#36669 Lead-authored-by: David Li <[email protected]> Co-authored-by: Matt Topol <[email protected]> Signed-off-by: David Li <[email protected]>
R-JunmingChen
pushed a commit
to R-JunmingChen/arrow
that referenced
this issue
Aug 20, 2023
…he#36670) ### Rationale for this change Prevent hard to debug crashes when using Go code with other code via C Data Interface. ### What changes are included in this PR? In the C Stream Interface implementation, jump through a trampoline that zeroes the out parameters before letting Go see them. Note that this can only guard against the issue when the C Stream Interface is used. Also, fix other issues in the C Data Interface tests with invalid pointers and uninitialized memory that were turned up by the new test here (because it calls `runtime.GC` very frequently). ### Are these changes tested? Yes ### Are there any user-facing changes? No **This PR contains a "Critical Fix".** * Closes: apache#36669 Lead-authored-by: David Li <[email protected]> Co-authored-by: Matt Topol <[email protected]> Signed-off-by: David Li <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug, including details regarding any error messages, version, and platform.
If an ArrowSchema etc. has a (garbage) pointer that looks like a Go pointer (due to reuse of stack memory/uninitialized memory), that C Data struct is passed to Go as an out parameter, and the Go code tries to write a new pointer to that value during a GC, the Go GC can get confused and will crash the program, probably because we hit this:
Component(s)
Go
The text was updated successfully, but these errors were encountered: