lkml.org 
[lkml]   [2023]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 04/12] fprobe: Use ftrace_regs in fprobe entry handler
On Tue, 26 Sep 2023 00:14:33 +0200
Jiri Olsa <olsajiri@gmail.com> wrote:

> On Mon, Sep 25, 2023 at 09:15:15PM +0900, Masami Hiramatsu wrote:
> > Hi Jiri,
> >
> > On Mon, 25 Sep 2023 12:41:59 +0200
> > Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > > On Sun, Sep 24, 2023 at 10:36:36PM +0900, Masami Hiramatsu (Google) wrote:
> > > > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > > >
> > > > This allows fprobes to be available with CONFIG_DYNAMIC_FTRACE_WITH_ARGS
> > > > instead of CONFIG_DYNAMIC_FTRACE_WITH_REGS, then we can enable fprobe
> > > > on arm64.
> > > >
> > > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > > > Acked-by: Florent Revest <revest@chromium.org>
> > >
> > > I was getting bpf selftests failures with this patchset and when
> > > bisecting I'm getting crash when running on top of this change
> >
> > Thanks for bisecting!
> >
> > >
> > > looks like it's missing some of the regs NULL checks added later?
> >
> > yeah, if the RIP (arch_rethook_prepare+0x0/0x30) is correct,
> >
> > void arch_rethook_prepare(struct rethook_node *rh, struct ftrace_regs *fregs, bool mcount)
> >
> > RSI (the 2nd argument) is NULL. This means fregs == NULL and caused the crash.
> > I think ftrace_get_regs(fregs) for the entry handler may return NULL.
> >
> > Ah,
> >
> > @@ -182,7 +182,7 @@ static void fprobe_init(struct fprobe *fp)
> > fp->ops.func = fprobe_kprobe_handler;
> > else
> > fp->ops.func = fprobe_handler;
> > - fp->ops.flags |= FTRACE_OPS_FL_SAVE_REGS;
> > + fp->ops.flags |= FTRACE_OPS_FL_SAVE_ARGS;
> > }
> >
> > static int fprobe_init_rethook(struct fprobe *fp, int num)
> >
> > This may cause the issue, it should keep REGS at this point (this must be done in
> > [9/12]). But after applying [9/12], it shouldn't be a problem...
> >
> > Let me check it again.
>
> that helped with the crash, I'll continue bisecting to find out
> where it breaks the tests

Can you share the configuration and the test?
I would like to reproduce it because I couldn't make it reproduced.

Thank you,

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2023-09-26 02:21    [W:5.957 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site