Re: [PATCH] Revert "kprobes: Warn if optprobe handler tries to change execution path"

From: Naveen N. Rao
Date: Mon Oct 23 2017 - 09:58:34 EST


On 2017/10/19 09:38PM, Masami Hiramatsu wrote:
> On Tue, 17 Oct 2017 13:48:34 +0530
> "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxxxxxxx> wrote:
>
> > This reverts commit e863d539614641 ("kprobes: Warn if optprobe handler
> > tries to change execution path").
> >
> > On powerpc, we place a probe at kretprobe_trampoline to catch function
> > returns and with CONFIG_OPTPROBES, this probe gets optimized. This
> > works for us due to the way we handle the optprobe as described in
> > commit 762df10bad6954 ("powerpc/kprobes: Optimize kprobe
> > in kretprobe_trampoline()"). With the above commit, we end up with a
> > warning. As such, revert this change.
>
> OK, so for ppc, optprobe can handle nip change.
>
> Acked-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
>
> I'll update the document too.

Thanks. We don't quite handle the nip change (yet), but just work around
it for kretprobe trampoline by using the link register, and issuing a
'blr' after the trampoline code.

Regards,
Naveen