]> Cypherpunks repositories - gostls13.git/commit
runtime: improve error messages after allocating a stack that is too big
authorPaschalis Tsilias <paschalis.tsilias@gmail.com>
Fri, 18 Sep 2020 16:15:41 +0000 (19:15 +0300)
committerGiovanni Bajo <rasky@develer.com>
Sun, 20 Sep 2020 09:54:44 +0000 (09:54 +0000)
commit331614c4daa5504ddfe35a96371cc34783d14cf1
treeef3eab158a8ae1b62cc860a1710e42fbcb81de1c
parenta3868028ac8470d1ab7782614707bb90925e7fe3
runtime: improve error messages after allocating a stack that is too big

In the current implementation, we can observe crashes after calling
debug.SetMaxStack and allocating a stack larger than 4GB since
stackalloc works with 32-bit sizes. To avoid this, we define an upper
limit as the largest feasible point we can grow a stack to and provide a
better error message when we get a stack overflow.

Fixes #41228

Change-Id: I55fb0a824f47ed9fb1fcc2445a4dfd57da9ef8d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/255997
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/debug/garbage.go
src/runtime/proc.go
src/runtime/stack.go