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
runtime/cgo: fatal error: runtime: split stack overflow #14067
Comments
It happens on NetBSD too. |
It looks like this is the last missing piece for fixing signal stack setup issue introduced by a7cad52 in Go 1.6. The codepath goexit->crosscall2->cgocallback->cgocallback_gofunc->needm->minit on dragonfly and netbsd doesn't setup a new signal stack correctly. |
I think this is another instance of the odd NetBSD/DragonFly behaviour: a thread created by pthread_create inherits the signal stack of the creating thread. This means that C code that calls pthread_create to create a thread that calls back into Go is broken. The Go code will use the existing signal stack, and there will be two thread sharing a signal stack, which can't work. |
FWIW, I'm just running https://go-review.googlesource.com/#/c/18834 on trybots. It just tests whether stack_t.ss_flags==0 in minit and I'm a bit surprised that the test fails even on Darwin or Linux. Perhaps we should not rely on the report from sigatlstack system call. |
When a thread has a signal stack installed, and we call sigaltstack on that thread when we are not running in a signal handler, then it is normal for sigaltstack to return a stack_t with ss_flags == 0. It won't return SS_ONSTACK, because it is not actually running on the signal stack. And it won't return SS_DISABLE, because the signal stack is not disabled. |
I see. Thanks for the explanation. |
CL https://golang.org/cl/18835 mentions this issue. |
CL https://golang.org/cl/29491 mentions this issue. |
…lly on dragonfly This change reverts CL 18835 which is a workaroud for older DragonFly BSD kernels, and fixes #14051, #14052 and #14067 in a more general way the same as other platforms except NetBSD. This change also bumps the minimum required version of DragonFly BSD kernel to 4.4.4. Fixes #16329. Change-Id: I0b44b6afa675f5ed9523914226bd9ec4809ba5ae Reviewed-on: https://go-review.googlesource.com/29491 Reviewed-by: Ian Lance Taylor <iant@golang.org>
/cc @ianlancetaylor
git rev-parse: HEAD a4599ef on dragonfly 4.4-RELEASE x86_64.
TestCthread in misc/cgo/cgo_test.go crashes like the following:
At the same time the kernel warns about the trapped frame corruption like the follwoing:
The text was updated successfully, but these errors were encountered: