Sanity check frame pointer while stackwalking

BUG=

Change-Id: Ib9b0fd5ba7f829f8be8cf856ab371c6540279ee5
Reviewed-on: https://chromium-review.googlesource.com/458526
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
Joshua Peraza 2017-03-22 16:12:05 -07:00
parent 124035f4fb
commit 6cfdde4b91
2 changed files with 8 additions and 1 deletions

View File

@ -215,6 +215,12 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByFramePointerRecovery(
return NULL;
}
// Sanity check that resulting rbp is still inside stack memory.
uint64_t unused;
if (!memory_->GetMemoryAtAddress(caller_rbp, &unused)) {
return NULL;
}
StackFrameAMD64* frame = new StackFrameAMD64();
frame->trust = StackFrame::FRAME_TRUST_FP;
frame->context = last_frame->context;

View File

@ -690,7 +690,8 @@ TEST_F(GetCallerFrame, CallerPushedRBP) {
// frame 1
.Mark(&frame1_sp)
.Append(32, 0) // body of frame1
.Mark(&frame1_rbp); // end of stack
.Mark(&frame1_rbp) // end of stack
.D64(0);
RegionFromSection();
raw_context.rip = 0x00007400c0000200ULL;