On Fri, Oct 16, 2020 at 12:14:31PM +0100, Mark Rutland wrote: > Mark B's reply dropped this, but the next paragraph covered that: > > | I was planning to send a mail once I've finished writing a test, but > | IIUC there are some windows where ftrace/kretprobes > | detection/repainting may not work, e.g. if preempted after > | ftrace_return_to_handler() decrements curr_ret_stack, but before the > | arch trampoline asm restores the original return addr. So we might > | need something like an in_return_trampoline() to detect and report > | that reliably. > > ... so e.g. for a callchain A->B->C, where C is instrumented there are > windows where B might be missing from the trace, but the trace is > reported as reliable. I'd missed a couple of details, and I think I see how each existing architecture prevents this case now. Josh, just to confirm the x86 case, am I right in thinking that the ORC unwinder will refuse to unwind from the return_to_handler and kretprobe_trampoline asm? IIRC objtool shouldn't build unwind info for those as return_to_handler is marked with SYM_CODE_{START,END}() and kretprobe_trampoline is marked with STACK_FRAME_NON_STANDARD(). Both powerpc and s390 refuse to reliably unwind through exceptions, so they can rely on function call boundaries to keep the callchain in a sane state. Thanks, Mark.