From 757e0de89f80e89626cc8b7d6e670c0e5ea7f192 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 15 Aug 2013 22:34:06 -0400 Subject: runtime: impose stack size limit The goal is to stop only those programs that would keep going and run the machine out of memory, but before they do that. 1 GB on 64-bit, 250 MB on 32-bit. That seems implausibly large, and it can be adjusted. Fixes #2556. Fixes #4494. Fixes #5173. R=khr, r, dvyukov CC=golang-dev https://golang.org/cl/12541052 --- src/pkg/runtime/runtime.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/pkg/runtime/runtime.h') diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index b80e2ad41a..b87e64dfa1 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -259,6 +259,7 @@ struct G uintptr syscallguard; // if status==Gsyscall, syscallguard = stackguard to use during gc uintptr stackguard; // same as stackguard0, but not set to StackPreempt uintptr stack0; + uintptr stacksize; G* alllink; // on allg void* param; // passed parameter on wakeup int16 status; @@ -713,6 +714,7 @@ extern uint32 runtime·Hchansize; extern uint32 runtime·cpuid_ecx; extern uint32 runtime·cpuid_edx; extern DebugVars runtime·debug; +extern uintptr runtime·maxstacksize; /* * common functions and data -- cgit v1.3-5-g9baa