]> Cypherpunks repositories - gostls13.git/commit
runtime: fix signal stack bug
authorRuss Cox <rsc@golang.org>
Thu, 24 Feb 2011 21:46:44 +0000 (13:46 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 24 Feb 2011 21:46:44 +0000 (13:46 -0800)
commit820dc9ff1af5771a66ce4666e4e7620f831fba45
tree2703b1bfbda5db3ad91045aa078fb032283c113d
parentd94bf76239441a5a819043db37bde28f22e20621
runtime: fix signal stack bug

In CL 4188061 I changed malg to allocate the requested
number of bytes n, not n+StackGuard, so that the
allocations would use rounder numbers.

The allocation of the signal stack asks for 32k and
then used g->stackguard as the base, but g->stackguard
is StackGuard bytes above the base.  Previously, asking
for 32k meant getting 32k+StackGuard bytes, so using
g->stackguard as the base was safe.  Now, the actual base
must be computed, so that the signal handler does not
run StackGuard bytes past the top of the stack.

Was causing flakiness mainly in programs that use the
network, because they sometimes write to closed network
connections, causing SIGPIPEs.  Was also causing problems
in the doc/progs test.

Also fix Makefile so that changes to stack.h trigger rebuild.

R=bradfitzgo, r, r2
CC=golang-dev
https://golang.org/cl/4230044
src/Make.pkg
src/pkg/runtime/Makefile
src/pkg/runtime/darwin/thread.c
src/pkg/runtime/freebsd/thread.c
src/pkg/runtime/linux/thread.c