]> Cypherpunks repositories - gostls13.git/commit
runtime: remove write barrier in WaitForSigusr1
authorAustin Clements <austin@google.com>
Sat, 2 Nov 2019 22:39:17 +0000 (18:39 -0400)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Nov 2019 14:34:46 +0000 (14:34 +0000)
commitb82404837d3f2227115f70687d318689535b8a2d
tree2bbcfa81762eed6976dedb173352f2133e14337f
parentf891b7c3425621d0ec3771144182507c90a80cff
runtime: remove write barrier in WaitForSigusr1

WaitForSigusr1 registers a callback to be called on SIGUSR1 directly
from the runtime signal handler. Currently, this callback has a write
barrier in it, which can crash with a nil P if the GC is active and
the signal arrives on an M that doesn't have a P.

Fix this by recording the ID of the M that receives the signal instead
of the M itself, since that's all we needed anyway. To make sure there
are no other problems, this also lifts the callback into a package
function and marks it "go:nowritebarrierrec".

Fixes #35248.

Updates #35276, since in principle a write barrier at exactly the
wrong time while entering the scheduler could cause issues, though I
suspect that bug is unrelated.

Change-Id: I47b4bc73782efbb613785a93e381d8aaf6850826
Reviewed-on: https://go-review.googlesource.com/c/go/+/204620
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/export_unix_test.go