]> Cypherpunks repositories - gostls13.git/commit
runtime: restore caller's frame pointer when recovering from panic
authorNick Ripley <nick.ripley@datadoghq.com>
Fri, 4 Aug 2023 21:31:43 +0000 (17:31 -0400)
committerMichael Knyszek <mknyszek@google.com>
Tue, 15 Aug 2023 14:52:21 +0000 (14:52 +0000)
commitb51a4dd6c43194d8680a05ea735a02d70af976af
tree2586334b2301b3f5b9e715d98b7371dda7d6de2a
parent94d36fbc4acdbcff5d4d7ad3869f285294c4181c
runtime: restore caller's frame pointer when recovering from panic

When recovering from a panic, restore the caller's frame pointer before
returning control to the caller. Otherwise, if the function proceeds to
run more deferred calls before returning, the deferred functions will
get invalid frame pointers pointing to an address lower in the stack.
This can cause frame pointer unwinding to crash, such as if an execution
trace event is recorded during the deferred call on architectures which
support frame pointer unwinding.

Fixes #61766

Change-Id: I45f41aedcc397133560164ab520ca638bbd93c4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/516157
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
src/runtime/callers_test.go
src/runtime/export_test.go
src/runtime/panic.go