]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't block preemption signal in new M's or ensureSigM
authorIan Lance Taylor <iant@golang.org>
Fri, 15 Apr 2022 20:46:00 +0000 (13:46 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 15 Apr 2022 23:25:46 +0000 (23:25 +0000)
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.

Fixes #52226

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>
src/runtime/signal_unix.go

index 8bde739c6497855bf210ec640d664251a1a2203e..3db789396d62948e5132bf1f5ccc98c44042fd0c 100644 (file)
@@ -1247,6 +1247,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
@@ -1257,6 +1258,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
        }