mdb's ::stacks command can loop forever
mdb's ::stacks dcmd can loop forever if it encounters a bad frame pointer that points to itself.
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.