From 5c7535af7808b02de0c6670cf16086efe48ebd89 Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Wed, 7 Oct 2020 12:27:28 -0700 Subject: [PATCH] amd64: reject frames with invalid rsp/rip CFI might compute invalid rsp/rip values if the values in the callee frame were corrupted, as in stack overflow. Rejecting the frame computed by CFI allows Breakpad to fall-back to scanning. Bug: b/169611285 Change-Id: Ifeb08ab5639932c0e23722a161d9d15403738019 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2456037 Reviewed-by: Mark Mentovai --- src/processor/stackwalker_amd64.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/processor/stackwalker_amd64.cc b/src/processor/stackwalker_amd64.cc index f906f20b..f346a4ee 100644 --- a/src/processor/stackwalker_amd64.cc +++ b/src/processor/stackwalker_amd64.cc @@ -143,6 +143,11 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByCFIFrameInfo( if ((frame->context_validity & essentials) != essentials) return NULL; + if (!frame->context.rip || !frame->context.rsp) { + BPLOG(ERROR) << "invalid rip/rsp"; + return NULL; + } + frame->trust = StackFrame::FRAME_TRUST_CFI; return frame.release(); }