mirror of
https://github.com/golang/go.git
synced 2025-05-17 05:14:40 +00:00
runtime: don't re-raise ignored signal
If a signal lands on a non-Go thread, and Go code doesn't want to handle it, currently we re-raise the signal in the signal handler after uninstalling our handler, so the C code can handle it. But if there is no C signal handler and the signal is ignored, there is no need to re-raise the signal. Just ignore it. This avoids uninstalling and reinstalling our handler, which, for some reason, changes errno when TSAN is used. And TSAN does not like errno being changed in the signal handler. Not really sure if this is the bset of complete fix, but it does fix the immediate problem, and it seems a reasonable thing to do by itself. Test case is CL 581722. Fixes #66427. Change-Id: I7a043d53059f1ff4080f4fc8ef4065d76ee7d78a Reviewed-on: https://go-review.googlesource.com/c/go/+/582077 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
be29a02161
commit
be003bd00b
@ -953,10 +953,17 @@ func raisebadsignal(sig uint32, c *sigctxt) {
|
||||
}
|
||||
|
||||
var handler uintptr
|
||||
var flags int32
|
||||
if sig >= _NSIG {
|
||||
handler = _SIG_DFL
|
||||
} else {
|
||||
handler = atomic.Loaduintptr(&fwdSig[sig])
|
||||
flags = sigtable[sig].flags
|
||||
}
|
||||
|
||||
// If the signal is ignored, raising the signal is no-op.
|
||||
if handler == _SIG_IGN || (handler == _SIG_DFL && flags&_SigIgn != 0) {
|
||||
return
|
||||
}
|
||||
|
||||
// Reset the signal handler and raise the signal.
|
||||
|
Loading…
x
Reference in New Issue
Block a user