Re: [PATCH v3] kprobes: Disable Kprobe when ftrace arming fails

From: Petr Mladek
Date: Mon Mar 23 2015 - 06:12:38 EST


On Mon 2015-03-23 09:54:26, Ingo Molnar wrote:
>
> * Petr Mladek <pmladek@xxxxxxx> wrote:
>
> > arm_kprobe_ftrace() could fail, especially after introducing ftrace
> > IPMODIFY flag and LifePatching. But this situation is not properly
> > handled.
>
> s/LifePatching/LivePatching?

Great catch! This is well hidden typo. Please, find the fixed version
below.


> Why not fix live patching to still allow kprobes that worked before?

Yup, Kretprobes would work out of box. Masami is working on removing
the conflict there.

Jprobes are doable but the solution would be rather complicated.
LivePatching would need to tell Jprobe the right address where to
continue (according to the universe). We currently solve this by
the conflict. I am not sure if a better solution is worth the effort.
IMHO, LivePatch users won't want to have Kprobes on a production
system all the time. They could use Kprobe or attach Jprobe to the
new version of the function when needed.

Kprobes are basically impossible to keep if they are attached inside
the patched function. We would need to disassemble the code and guess
the location. Instead, we are going to print warning when a Kprobe
will get ignored.


Below is the patch with the fixed typo.