Re: [PATCH] x86/unwind/orc: Fix unwind ip when kprobes hits push/pop

From: Josh Poimboeuf
Date: Fri Feb 10 2023 - 16:31:02 EST


On Thu, Dec 01, 2022 at 04:53:11PM +0800, Chen Zhongjin wrote:
> When unwind stack at asm_exc_int3, the orc type is UNWIND_HINT_TYPE_REGS
> and the unwinder will use pt_regs->ip to find next orc, which point to
> the probed insn + INT3_INSN_SIZE.
>
> If the probed insn is push/pop, it will point to the next insn which has
> different orc state. Before the probed insn has been really excuted in
> single step, using next insn ip to find orc will get a wrong unwinding
> result.
>
> So, when there is kprobe running and the previous op code is int3,
> state->signal should be false so that ip - 1 will be used to find next
> orc, until the probed push/pop has been single steped and kprobe set
> kprobe_status as KPROBE_HIT_SSDONE.
>
> Fixes: ee9f8fce9964 ("x86/unwind: Add the ORC unwinder")
> Signed-off-by: Chen Zhongjin <chenzhongjin@xxxxxxxxxx>

Hi Chen,

Thanks for reporting this, and sorry for the delay. I would rather fix
this in a more general way, by specifying 'signal' (or lack thereof) in
the ORC data. I will work up a patch.

--
Josh