[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240613094241.549038df@rorschach.local.home>
Date: Thu, 13 Jun 2024 09:42:41 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Naresh Kamboju <naresh.kamboju@...aro.org>
Cc: open list <linux-kernel@...r.kernel.org>, lkft-triage@...ts.linaro.org,
Linux Regressions <regressions@...ts.linux.dev>, Dan Carpenter
<dan.carpenter@...aro.org>, Arnd Bergmann <arnd@...db.de>, Masami Hiramatsu
<mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>
Subject: Re: LTP tracing crashed on arm64 rk3399-rock-pi-4 - pc :
ftrace_ops_test
On Thu, 13 Jun 2024 13:29:58 +0530
Naresh Kamboju <naresh.kamboju@...aro.org> wrote:
> > --- a/kernel/trace/fgraph.c
> > +++ b/kernel/trace/fgraph.c
> > @@ -641,7 +641,7 @@ int function_graph_enter(unsigned long ret, unsigned long func,
> > {
> > for_each_set_bit(i, &fgraph_array_bitmask,
> > sizeof(fgraph_array_bitmask) * BITS_PER_BYTE) {
> > - struct fgraph_ops *gops = fgraph_array[i];
> > + struct fgraph_ops *gops = READ_ONCE(fgraph_array[i]);
> > int save_curr_ret_stack;
> >
> > if (gops == &fgraph_stub)
> >
> >
> > Because if the compiler decides to re-read gops from fgraph_array[i] after the
> > above check for the following line that does:
> >
> > save_curr_ret_stack = current->curr_ret_stack;
> > if (ftrace_ops_test(&gops->ops, func, NULL) &&
> > gops->entryfunc(&trace, gops))
> > bitmap |= BIT(i);
> >
> >
> > and gops now points to fgraph_stub, it will trigger this bug.
> >
> > Can you apply the above change and see if the bug goes away?
>
> I will apply this patch and run the test in a loop.
> Since it is only seen once. Not sure I could validate this and confirm.
We could just look at the code that clang produced and see if it
accesses the fgraph_array[] again. If this was the cause, it would show
up it in the code.
But regardless, I think I'm going to add that READ_ONCE() anyway,
because it is legitimate for the compiler to do the above without it.
Thanks,
-- Steve
Powered by blists - more mailing lists