Reviewed by: Brad Lewis <brad.le...@delphix.com>
Reviewed by: Prakash Surya <prakash.su...@delphix.com>
Reviewed by: Paul Dagnelie <p...@delphix.com>

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.

Upstream bug: DLPX-55860
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/670

-- Commit Summary --

  * 9676 mdb's ::stacks command can loop forever

-- File Changes --

    M usr/src/cmd/mdb/common/modules/genunix/findstack_subr.c (21)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/670.patch
https://github.com/openzfs/openzfs/pull/670.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/670

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/T0a20d78ceac3a60d-M9bd30e6de1aaad1f89f47a26
Delivery options: https://openzfs.topicbox.com/groups/developer/subscription

Reply via email to