diff options
author | Abseil Team <absl-team@google.com> | 2024-01-23 10:46:19 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-01-23 10:47:32 -0800 |
commit | 6dda8e527f19a6508ab855641914945a20d6b6df (patch) | |
tree | 591a9bc19a971689ceb645c626fd610fcba4dbb8 /absl | |
parent | 4676ffa9811c10d11fc2c782d9399a3f41d739b8 (diff) |
Always check if the new frame pointer is readable.
Terminate the stack trace if it isn't.
PiperOrigin-RevId: 600839499
Change-Id: I5692fa6cb52c4c8061b4ac14d8fba70f7fbabc52
Diffstat (limited to 'absl')
-rw-r--r-- | absl/debugging/internal/stacktrace_aarch64-inl.inc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc index 1caf7bbe..1e07e042 100644 --- a/absl/debugging/internal/stacktrace_aarch64-inl.inc +++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc @@ -122,13 +122,6 @@ static void **NextStackFrame(void **old_frame_pointer, const void *uc, if (pre_signal_frame_pointer >= old_frame_pointer) { new_frame_pointer = pre_signal_frame_pointer; } - // Check that alleged frame pointer is actually readable. This is to - // prevent "double fault" in case we hit the first fault due to e.g. - // stack corruption. - if (!absl::debugging_internal::AddressIsReadable( - new_frame_pointer)) - return nullptr; - } } #endif @@ -136,6 +129,14 @@ static void **NextStackFrame(void **old_frame_pointer, const void *uc, if ((reinterpret_cast<uintptr_t>(new_frame_pointer) & 7) != 0) return nullptr; + // Check that alleged frame pointer is actually readable. This is to + // prevent "double fault" in case we hit the first fault due to e.g. + // stack corruption. + if (!absl::debugging_internal::AddressIsReadable( + new_frame_pointer)) + return nullptr; + } + // Only check the size if both frames are in the same stack. if (InsideSignalStack(new_frame_pointer, stack_info) == InsideSignalStack(old_frame_pointer, stack_info)) { |