-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: signal handling: sigtrampgo stack check fails in deferred TSAN handler call #18255
Comments
It shouldn't matter whether the signal occurs while the goroutine is executing on the g0 stack or not. If the signal handler is not running on the gsignal stack, that implies that the signal handler was not run on the alternate signal stack. That suggests that the runtime prints: |
I see the problem. The TSAN support library collects signals and their signal handlers, and then delivers the signals by calling the signal handlers directly. That is, the TSAN library ignores the CC @dvyukov Absent a fix to TSAN, perhaps we could have the Go signal handler decide that all is well if the stack pointer is on the g0 stack. |
I don't think there's really anything to fix in TSAN: it is handling the signal proper on an alternate stack, so there's no risk of blowing out the goroutine stack. It just happens to be waiting until the next libc call to deliver the signal (at which point it has good reason to believe that the stack is reasonably large and in a valid state). I was thinking about making |
What do you think of https://golang.org/cl/34239 ? |
CL https://golang.org/cl/34239 mentions this issue. |
The fix for #17753 fixed the runtime's registration with the TSAN signal interceptor. When an asynchronous signal (such as
SIGPROF
) arrives while a C thread is running, it appears that TSAN defers the signal handler call until the next libc call after the signal occurs.In a Go program, the libc call typically occurs on the
g0
stack, notgsignal
, so the sanity-check insigtrampgo
(to verify that we're ongsignal
) fails.I'm not entirely sure what the appropriate fix is. (@ianlancetaylor, any ideas?)
A repro case follows.
tsanprof.go:
The text was updated successfully, but these errors were encountered: