-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: after g0.stack is adjusted in x_cgo_init(), g0.stack.lo cannot be accessed. #35552
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
Comments
Please refer to the following debug information. import "C" func main() {
|
I also found that this would cause gsignal.stack.lo to be unreachable. Because adjustSignalStack() will set the gsignal stack of the current m to the g0 stack if the signal is delivered on the g0 stack. |
CC @cherrymui |
I feel like you've skipped a few steps. Does this only happens on linux-arm64? Are you saying that |
Also, what actually goes wrong? |
As far as I can tell, nothing goes wrong. Some background: @zhangfannie and I had some conversation in email about why writing to gsignal.stack.lo failed before CL https://go-review.googlesource.com/c/go/+/204519. |
@ianlancetaylor Please refer to for additional details. And the behavior of x86 is the same. Thank you. Breakpoint 1, x_cgo_init (g=0x569cc0 <runtime.g0>, setg=, tlsg=0x0, tlsbase=0xffffb7ff8700) at gcc_linux_arm64.c:89
(gdb) |
Thanks. Perhaps the issue is that the default stack grows as needed. Or perhaps the thread default stack size simply isn't applicable to the main thread. Any idea how we can determine the size of the stack here? I suppose we could always just guess. I'm not sure it matters much. |
@cherrymui Thanks for providing the background. |
Looks like a dup of #26061. |
In the initial process, go runtime(runtime.rt0_go()) calls _cgo_init() when using cgo, the x_cgo_init() extends g0.stack which causes g0.stack.lo cannot be accessed.
The text was updated successfully, but these errors were encountered: