Re: [PATCH v2 12/39] x86/ibt,ftrace: Search for __fentry__ location
From: Steven Rostedt
Date: Thu Mar 03 2022 - 09:34:23 EST
On Thu, 3 Mar 2022 14:04:52 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > @@ -1596,7 +1596,7 @@ static int check_ftrace_location(struct kprobe *p)
> > {
> > unsigned long ftrace_addr;
> >
> > - ftrace_addr = ftrace_location((unsigned long)p->addr);
> > + ftrace_addr = ftrace_location_range((unsigned long)p->addr, (unsigned long)p->addr);
>
> Yes, although perhaps a new helper. I'll go ponder during lunch.
Is there more places to add that to make it worth creating a helper?
If not, I would just keep using the ftrace_location_range().
If there is to be a helper function, then we should not have touched
ftrace_location() in the first place, and instead created a new function
that does the offset check.
Because thinking about this more, ftrace_location() is suppose to act just
like ftrace_location_range() and now it does not.
I rather keep ftrace_location() the same as ftrace_location_range() if
there's going to be another API. Maybe create a function ftrace_addr() that
does the new ftrace_location() that you have, and leave ftrace_location()
as is?
This is actually what I suggested in the beginning.
-- Steve