[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201029103744.0f7f52dc@gandalf.local.home>
Date: Thu, 29 Oct 2020 10:37:44 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Miroslav Benes <mbenes@...e.cz>
Cc: linux-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Jiri Kosina <jikos@...nel.org>, Petr Mladek <pmladek@...e.com>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org
Subject: Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the
ftrace callback
On Thu, 29 Oct 2020 14:51:06 +0100 (CET)
Miroslav Benes <mbenes@...e.cz> wrote:
> > index b552cf2d85f8..6c0164d24bbd 100644
> > --- a/kernel/livepatch/patch.c
> > +++ b/kernel/livepatch/patch.c
> > @@ -45,9 +45,13 @@ static void notrace klp_ftrace_handler(unsigned long ip,
> > struct klp_ops *ops;
> > struct klp_func *func;
> > int patch_state;
> > + int bit;
> >
> > ops = container_of(fops, struct klp_ops, fops);
> >
> > + bit = ftrace_test_recursion_trylock();
> > + if (bit < 0)
> > + return;
>
> This means that the original function will be called in case of recursion.
> That's probably fair, but I'm wondering if we should at least WARN about
> it.
It's probably what happens today. But if you add a WARN_ON_ONCE() it may
not hurt.
I also plan on adding code that reports when recursion has happened,
because even if it's not a problem, recursion adds extra overhead.
-- Steve
Powered by blists - more mailing lists