From 1895014257138311efc6f79be93a8715f8809586 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Wed, 19 Mar 2014 17:04:51 +0400 Subject: [PATCH] runtime: fix stack split detection around fork If runtime_BeforeFork splits stack, it will unsplit it with spoiled g->stackguard. It leads to check failure in oldstack: fatal error: stackfree: bad fixed size runtime stack: runtime.throw(0xadf3cd) runtime.stackfree(0xc208040480, 0xfffffffffffff9dd, 0x1b00fa8) runtime.oldstack() runtime.lessstack() goroutine 311 [stack unsplit]: syscall.forkAndExecInChild(0xc20802eea0, 0xc208192c00, 0x5, 0x5, 0xc208072a80, ...) syscall.forkExec(0xc20802ed80, 0x54, 0xc2081ccb40, 0x4, 0x4, ...) Fixes #7567. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, khr, rsc https://golang.org/cl/77340045 --- src/pkg/runtime/proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index e11f9b18ac..b5093497d9 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -1696,6 +1696,7 @@ exitsyscall0(G *gp) } // Called from syscall package before fork. +#pragma textflag NOSPLIT void syscall·runtime_BeforeFork(void) { -- 2.48.1