Re: [RFC PATCH 1/2] x86: Fix rbp saving in pt_regs on irq entry

Ingo Molnar
2011-01-07T12:31:43Z

* Jan Beulich <JBeulich@novell.com> wrote:

> > Now I don't understand how this is all useful as this is not a normal proc but
> > an interruption. We can't get back the return address from the CFA. Or am I
> > missing something?
>
> Unwind annotations, when written correctly, allow unwinding through all kinds of
> execution flows, including interrupts or exceptions as well as including stack
> switches.

Yeah and that's rather useful, as exception contexts can nest in very weird ways,
especially with NMIs involved. For example a 7-context combination is possible:

user-space -> syscall -> pagefault -> softirq -> hardirq -> debug trap -> NMI

And the call frame walking logic needs to be able to get all the way back to
user-space ...

For that every transition needs to work flawlessly, for debugging (and CFI based
profiling) to work fine.

Most of those transitions can happen at any instruction boundary that a given
context executes, so the total number of possible combinations is virtually endless.

Unfortunately we dont seem to have a good way to test any of this automatically.
Putting a perf probe on every assembly instruction perhaps, and checking whether the
frame manages to go back all the way to user-space?

Thanks,

Ingo