You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
In cgo mode for UNIX platforms, we compute the g0 stack bounds by querying the stack size from pthread_get_stacksize, subtracting that from the current SP in mstart, and adding a 1k buffer. However, on my Linux laptop, over 4k of the stack has already been consumed by the time we reach mstart, so the runtime sets the bottom of the g0 stack to be below the mapped memory. As a result, if we actually overflow the g0 stack, we get a segfault instead of a useful message with a traceback.
We should use pthread_get_stack instead to get both stack bounds.
Discovered when writing a test of overflowing the g0 stack for #21382, which I had assumed would pass on linux/amd64 but didn't.
The text was updated successfully, but these errors were encountered:
This test fails when run on ios. (Although ios does not normally
support "exec", in the corellium environment it does.)
TryBot-Result: Gopher Robot <firstname.lastname@example.org>
Auto-Submit: Bryan Mills <email@example.com>
Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>
Run-TryBot: Bryan Mills <email@example.com>