Re: [PATCH] ftrace: avoid replacing the list func with itself

From: Song Shuai
Date: Mon Nov 21 2022 - 21:37:56 EST


Steven Rostedt <rostedt@xxxxxxxxxxx> 于2022年11月22日周二 02:34写道:
>
> On Tue, 22 Nov 2022 02:28:25 +0000
> Song Shuai <suagrfillet@xxxxxxxxx> wrote:
>
> > Song Shuai <suagrfillet@xxxxxxxxx> 于2022年10月26日周三 13:20写道:
> > >
> > > The list func (ftrace_ops_list_func) will be patched first
> > > before the transition between old and new calls are set,
> > > which fixed the race described in this commit `59338f75`.
> > >
> > > While ftrace_trace_function changes from the list func to a
> > > ftrace_ops func, like unregistering the klp_ops to leave the only
> > > global_ops in ftrace_ops_list, the ftrace_[regs]_call will be
> > > replaced with the list func although it already exists. So there
> > > should be a condition to avoid this.
> > >
> > > This patch backups saved_ftrace_func by saved_ftrace_func_old
> > > which will be compared with the list func before trying to patch it.
> > >
> > Ping...
>
> Thanks for the ping. I had thought I had replied to this, but I don't
> see it in my sent folder. I may have been distracted, and lost the
> message.
>
> I'll take a look at it tomorrow.
>
> -- Steve
No problem, thanks!

-- Song