Re: [PATCH v2 15/39] x86/ibt,kprobes: Fix more +0 assumptions
From: Steven Rostedt
Date: Fri Feb 25 2022 - 09:14:17 EST
On Fri, 25 Feb 2022 11:46:23 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> Given all that, kprobe users are in a bit of a bind. Determining the
> __fentry__ point basically means they *have* to first read the function
> assembly to figure out where it is.
Technically I think that's what kprobes has been designed for. But
realistically, I do not think anyone actually does that (outside of
academic and niche uses).
Really, when people use func+0 they just want to trace the function, and
ftrace is the fastest way to do so, and if it's not *exactly* at function
entry, but includes the arguments, then it should be fine.
That said, perhaps we should add a config to know if the architecture
uses function entry or the old mcount that is after the frame set up (that
is, you can not get to the arguments).
CONFIG_HAVE_FTRACE_FUNCTION_START ?
Because, if the arch still uses the old mcount method (where it's after the
frame set up), then a kprobe at func+0 really wants the breakpoint.
-- Steve