mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: block signals in needm before allocating M
Otherwise, if a signal occurs just after we allocated the M, we can deadlock if the signal handler needs to allocate an M itself. Fixes #42207 Change-Id: I76f44547f419e8b1c14cbf49bf602c6e645d8c14 Reviewed-on: https://go-review.googlesource.com/c/go/+/265759 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>
This commit is contained in:
parent
94f3762462
commit
368c401164
7 changed files with 127 additions and 17 deletions
|
|
@ -358,3 +358,12 @@ func TestSignalM(t *testing.T) {
|
|||
t.Fatalf("signal sent to M %d, but received on M %d", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #42207.
|
||||
func TestNeedmDeadlock(t *testing.T) {
|
||||
output := runTestProg(t, "testprogcgo", "NeedmDeadlock")
|
||||
want := "OK\n"
|
||||
if output != want {
|
||||
t.Fatalf("want %s, got %s\n", want, output)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue