This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Getting user-space stack backtraces in more probe contexts
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Roland McGrath <roland at redhat dot com>
- Cc: William Cohen <wcohen at redhat dot com>, SystemTAP <systemtap at sources dot redhat dot com>
- Date: Mon, 17 May 2010 14:40:09 -0400
- Subject: Re: Getting user-space stack backtraces in more probe contexts
- References: <4BEC6954.6090802@redhat.com> <20100514073617.69414400C0@magilla.sf.frob.com>
roland wrote:
> [...]
> Now, to those three paths.
> 1. Work with what you got.
> [...]
> This means, give the user unwinder some arch-specific code to
> prime its state from a known-to-be-partial struct pt_regs. [...]
> [...] But the bare guess is that it might well tend to cover
> just recovering the PC and CFA (enough to keep doing a basic
> backtrace) much more often than it covers all the registers [...]
I like it as a fallback / heuristic. (Plus we should be able to fall
back to frame-pointer heuristics and/or the kernel's guesswork.)
> 2. Turtles all the way down!
> [...]
> (The turtles are made of CFI.) That is, unwind in kernel space all
> the way back to the red line. [...]
> In 100% proper CFI these frames are marked as "signal frames" (it's
> part of the "augmentation string"), so you can see those and then
> check whether the "caller's PC" of that frame is < TASK_SIZE
> [...]
> All this requires is that all kernel code have CFI, that the CFI be
> correct, and that you have that CFI. Three small matters. [...]
I like it. This seems like the best first try.
> 3. Two phase with a safe point
> This is the notion that Will mentioned, but there is a general and
> optimal way to do it. It's a classic "software interrupt" scheme:
> at an arbitrary point, put down a marker [...]
I don't like it as much. It's far more complex, plus I would like not
to sacrifice the ability to process backtraces as first class run-time
objects.
> 4. Pre-collect via syscall-entry tracing
> [...]
I like this, but doesn't appear to handle the interrupt / signal /
preemption type involuntary jumps into kernel space.
- FChE