Skip to content

Commit e45c262

Browse files
prattmicgopherbot
authored andcommitted
runtime/cgo: add note about default stack bounds
The default case in x_cgo_getstackbound does not actually get the stack bound of the current thread, but estimates the bound based on the default stack size. Add a comment noting this. Change-Id: I7d886461f0bbc795834bed37b554417cf3837a2d Reviewed-on: https://go-review.googlesource.com/c/go/+/563376 Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 4619121 commit e45c262

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/cgo/gcc_stack_unix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ x_cgo_getstackbound(uintptr bounds[2])
2929
pthread_attr_get_np(pthread_self(), &attr);
3030
pthread_attr_getstack(&attr, &addr, &size); // low address
3131
#else
32+
// We don't know how to get the current stacks, so assume they are the
33+
// same as the default stack bounds.
3234
pthread_attr_init(&attr);
3335
pthread_attr_getstacksize(&attr, &size);
3436
addr = __builtin_frame_address(0) + 4096 - size;

0 commit comments

Comments
 (0)