aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asm_amd64.s15
-rw-r--r--src/runtime/asm_arm64.s15
2 files changed, 30 insertions, 0 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index a4c6c53a90..f4244f6e06 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -181,6 +181,14 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
MOVQ AX, 24(SP)
MOVQ BX, 32(SP)
+ // This is typically the entry point for Go programs.
+ // Call stack unwinding must not proceed past this frame.
+ // Set the frame pointer register to 0 so that frame pointer-based unwinders
+ // (which don't use debug info for performance reasons)
+ // won't attempt to unwind past this function.
+ // See go.dev/issue/63630
+ MOVQ $0, BP
+
// create istack out of the given (operating system) stack.
// _cgo_init may update stackguard.
MOVQ $runtime·g0(SB), DI
@@ -408,6 +416,13 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0
RET
TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME|NOFRAME,$0
+ // This is the root frame of new Go-created OS threads.
+ // Call stack unwinding must not proceed past this frame.
+ // Set the frame pointer register to 0 so that frame pointer-based unwinders
+ // (which don't use debug info for performance reasons)
+ // won't attempt to unwind past this function.
+ // See go.dev/issue/63630
+ MOVD $0, BP
CALL runtime·mstart0(SB)
RET // not reached
diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s
index 902a7066aa..01f2690f4e 100644
--- a/src/runtime/asm_arm64.s
+++ b/src/runtime/asm_arm64.s
@@ -109,6 +109,14 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
MOVW R0, 8(RSP) // argc
MOVD R1, 16(RSP) // argv
+ // This is typically the entry point for Go programs.
+ // Call stack unwinding must not proceed past this frame.
+ // Set the frame pointer register to 0 so that frame pointer-based unwinders
+ // (which don't use debug info for performance reasons)
+ // won't attempt to unwind past this function.
+ // See go.dev/issue/63630
+ MOVD $0, R29
+
#ifdef TLS_darwin
// Initialize TLS.
MOVD ZR, g // clear g, make sure it's not junk.
@@ -248,6 +256,13 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ // This is the root frame of new Go-created OS threads.
+ // Call stack unwinding must not proceed past this frame.
+ // Set the frame pointer register to 0 so that frame pointer-based unwinders
+ // (which don't use debug info for performance reasons)
+ // won't attempt to unwind past this function.
+ // See go.dev/issue/63630
+ MOVD $0, R29
BL runtime·mstart0(SB)
RET // not reached