This patch to libgo fixes a dumb bug in which catching a signal via the os/signal package could clobber the saved split-stack context, leading to disaster if the signal arrived at the wrong time. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Will commit to 4.8 branch when it reopens.
Ian
diff -r 9c8c4538fce7 libgo/runtime/go-signal.c --- a/libgo/runtime/go-signal.c Sat Oct 12 21:13:58 2013 -0700 +++ b/libgo/runtime/go-signal.c Mon Oct 14 14:00:36 2013 -0700 @@ -399,6 +399,7 @@ { G *gp; M *mp; + void *stack_context[10]; /* We are now running on the stack registered via sigaltstack. (Actually there is a small span of time between runtime_siginit @@ -409,7 +410,7 @@ if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_getcontext (&gp->stack_context[0]); + __splitstack_getcontext (&stack_context[0]); #endif } @@ -432,7 +433,7 @@ if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_setcontext (&gp->stack_context[0]); + __splitstack_setcontext (&stack_context[0]); #endif } }