]> Cypherpunks repositories - gostls13.git/commit
runtime: always install new signal stack on NetBSD and DragonFly
authorIan Lance Taylor <iant@golang.org>
Fri, 22 Jan 2016 05:56:38 +0000 (21:56 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 25 Jan 2016 02:50:40 +0000 (02:50 +0000)
commit801bebefa91205b0b69f2458701aac8169294884
tree7b4e0a3978ffb6ff6903081f5988b2796723fbde
parent3415d0c49ddb6c48a90919eb023c71c7e82c3189
runtime: always install new signal stack on NetBSD and DragonFly

On NetBSD and DragonFly a newly created thread inherits the signal stack
of the creating thread.  That means that in a cgo program a C thread
created using pthread_create will get the signal stack of the creating
thread, most likely a Go thread.  This will then lead to chaos if two
signals occur simultaneously.

We can't fix the general case.  But we can fix the case of a C thread
that calls a Go function, by installing a new signal stack and then
dropping it when we return to C.  That will break the case of a C thread
that calls sigaltstack and then calls Go, because we will drop the C
thread's alternate signal stack as we return from Go.  Still, this is
the 1.5 behavior.  And what else can we do?

Fixes #14051.
Fixes #14052.
Fixes #14067.

Change-Id: Iee286ca50b50ec712a4d929c7121c35e2383a7b9
Reviewed-on: https://go-review.googlesource.com/18835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/os1_dragonfly.go
src/runtime/os1_netbsd.go