Getting user-space stack backtraces in more probe contexts
Frank Ch. Eigler
fche@redhat.com
Tue May 18 04:27:00 GMT 2010
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
More information about the Systemtap
mailing list