Project

General

Profile

Bug #9676

mdb's ::stacks command can loop forever

Added by Brad Lewis over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Start date:
2018-07-26
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Problem
mdb's ::stacks dcmd can loop forever if it encounters a bad frame pointer that points to itself.

Solution
Check that the stack grows in the direction expected. For platforms like x86 where the stack grows down, this means that each frame pointer should be larger than the previous one as we walk up the stack.

There is already a check in the crawl function that the frame pointer is within a fixed memory window (between kbase and ktop in crawl()), so we shouldn't have to worry that we are breaking the ability to crawl backtraces that span multiple stacks (e.g. an interrupt handled on a separate stack). That existing check already causes crawl() to return an error in such scenarios.

Also available in: Atom PDF