]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/cgo: add note about default stack bounds
authorMichael Pratt <mpratt@google.com>
Mon, 12 Feb 2024 19:32:22 +0000 (14:32 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 12 Feb 2024 22:38:23 +0000 (22:38 +0000)
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 <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/cgo/gcc_stack_unix.c

index f3fead9c9eca6a2f9845e4decf875cd926d52880..67efd9bc6314127b3a8ec1dbd921094df2c44f1b 100644 (file)
@@ -29,6 +29,8 @@ x_cgo_getstackbound(uintptr bounds[2])
        pthread_attr_get_np(pthread_self(), &attr);
        pthread_attr_getstack(&attr, &addr, &size); // low address
 #else
+       // We don't know how to get the current stacks, so assume they are the
+       // same as the default stack bounds.
        pthread_attr_init(&attr);
        pthread_attr_getstacksize(&attr, &size);
        addr = __builtin_frame_address(0) + 4096 - size;