go/misc
Austin Clements 675eb72c28 runtime: run libc SIGSETXID and SIGCANCEL handlers on signal stack
These signals are used by glibc to broadcast setuid/setgid to all
threads and to send pthread cancellations.  Unlike other signals, the
Go runtime does not intercept these because they must invoke the libc
handlers (see issues #3871 and #6997).  However, because 1) these
signals may be issued asynchronously by a thread running C code to
another thread running Go code and 2) glibc does not set SA_ONSTACK
for its handlers, glibc's signal handler may be run on a Go stack.
Signal frames range from 1.5K on amd64 to many kilobytes on ppc64, so
this may overflow the Go stack and corrupt heap (or other stack) data.

Fix this by ensuring that these signal handlers have the SA_ONSTACK
flag (but not otherwise taking over the handler).

This has been a problem since Go 1.1, but it's likely that people
haven't encountered it because it only affects setuid/setgid and
pthread_cancel.

Fixes #9600.

Change-Id: I6cf5f5c2d3aa48998d632f61f1ddc2778dcfd300
Reviewed-on: https://go-review.googlesource.com/1887
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-23 01:33:36 +00:00
..
android build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
arm arm: add gdb support to android launcher script 2010-07-30 10:35:07 +03:00
cgo runtime: run libc SIGSETXID and SIGCANCEL handlers on signal stack 2014-12-23 01:33:36 +00:00
chrome/gophertool misc/chrome/gophertool: update for the git/gerrit transition 2014-12-18 07:34:46 +00:00
dashboard/codereview misc/dashboard/app, misc/dashboard/builder: delete from main repo; part of move to go.tools 2013-08-01 13:27:27 +10:00
git misc/git: add gofmt git pre-commit hook 2012-11-15 19:58:49 +01:00
linkcheck misc/linkcheck: better redirect handling, use meaningful exit code 2013-10-25 17:31:02 +03:00
makerelease misc/makerelease: fix build 2014-12-15 01:55:29 +00:00
nacl undo CL 176900044 / 561398621ba7 2014-11-17 14:21:29 +11:00
swig cmd/go: add any .c/.cc files to the SWIG shared library 2013-10-09 10:35:46 -07:00
benchcmp all: use golang.org/x/... import paths 2014-11-10 09:15:57 +11:00
editors misc: delete editor and shell support 2014-07-01 09:21:25 -07:00