aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-04-15 13:46:00 -0700
committerIan Lance Taylor <iant@golang.org>2022-05-06 23:12:25 +0000
commit3e79a84853091717c0274281270992f55d2fad04 (patch)
tree2b021e4c05f3e30987b6925de4c1f9ed9a3ef2ca
parenta286c7dd79ee888410f31b1688d4159ba4e674b6 (diff)
downloadgo-3e79a84853091717c0274281270992f55d2fad04.tar.gz
go-3e79a84853091717c0274281270992f55d2fad04.zip
[release-branch.go1.18] runtime: don't block preemption signal in new M's or ensureSigM
No test because we already have a test in the syscall package. The issue reports 1 failure per 100,000 iterations, which is rare enough that our builders won't catch the problem. For #52226 Fixes #52375 Change-Id: I17633ff6cf676b6d575356186dce42cdacad0746 Reviewed-on: https://go-review.googlesource.com/c/go/+/400315 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> (cherry picked from commit e3982660a73b04a87c08215cb5aaa16d816ea573) Reviewed-on: https://go-review.googlesource.com/c/go/+/400318 Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r--src/runtime/signal_unix.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 2dd4cc51a3..5cb51d10ba 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -1234,6 +1234,7 @@ func unminitSignals() {
// blockableSig reports whether sig may be blocked by the signal mask.
// We never want to block the signals marked _SigUnblock;
// these are the synchronous signals that turn into a Go panic.
+// We never want to block the preemption signal if it is being used.
// In a Go program--not a c-archive/c-shared--we never want to block
// the signals marked _SigKill or _SigThrow, as otherwise it's possible
// for all running threads to block them and delay their delivery until
@@ -1244,6 +1245,9 @@ func blockableSig(sig uint32) bool {
if flags&_SigUnblock != 0 {
return false
}
+ if sig == sigPreempt && preemptMSupported && debug.asyncpreemptoff == 0 {
+ return false
+ }
if isarchive || islibrary {
return true
}