Re: [RFC][PATCH 1/2] ftrace: Add modify_ftrace_direct()

From: Steven Rostedt
Date: Sun Nov 17 2019 - 17:18:40 EST


On Fri, 15 Nov 2019 13:51:26 -0800
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:

> Thanks a lot for implementing it.
> Switching to iterator just to modify the call.. hmm.
> So "call direct_bpf_A" gets replaced to "call ftrace_stub" to do the iterator
> only to patch "call direct_bpf_B" later. I'm struggling to see why do that when
> arch can provide call to call rewrite easily. x86 and others have such ability
> already. I don't understand why you want to sacrifice simplicity here.
> Anyway with all 3 apis (register, modify, unreg) it looks complete.
> I'll start playing with it on Monday.

Now if you take my latest for-next branch, and add the patch below, you
can then implement a ftrace_modify_direct_caller() in x86 (or whatever
architecture you'd like), that does what you want. I encapsulated the
code such that the stub trick is for those that don't implement their
own modification.

-- Steve