diff options
| author | Ian Lance Taylor <iant@golang.org> | 2021-04-20 17:02:37 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-04-21 02:39:25 +0000 |
| commit | c33ced6d8a2bb4db6896ff36cfcaac2bbdf123d1 (patch) | |
| tree | 055d10241924976a5c0c7474eb741a686a1a9900 /src | |
| parent | 190cb937f7acdc1568a09c0cbbe1c14031c94ca9 (diff) | |
| download | go-c33ced6d8a2bb4db6896ff36cfcaac2bbdf123d1.tar.xz | |
runtime: don't test sig.inuse in sigsend
Signals can be delivered on a different thread. There is no necessary
happens-before relationship between setting sig.inuse in signal_enable
and checking it in sigsend. It is theoretically possible, if unlikely,
that sig.inuse is set by thread 1, thread 2 receives a signal, does not
see that sig.inuse is set, and discards the signal. This could happen
if the signal is received immediately after the first call to signal_enable.
For #33174
Change-Id: Idb0f1c77847b7d4d418bd139e801c0c4460531d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/312131
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/sigqueue.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go index a282c7aca7..aae1d00046 100644 --- a/src/runtime/sigqueue.go +++ b/src/runtime/sigqueue.go @@ -72,7 +72,7 @@ const ( // It runs from the signal handler, so it's limited in what it can do. func sigsend(s uint32) bool { bit := uint32(1) << uint(s&31) - if !sig.inuse || s >= uint32(32*len(sig.wanted)) { + if s >= uint32(32*len(sig.wanted)) { return false } |
