lkml.org 
[lkml]   [2020]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@suse.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

\
 
 \ /
  Last update: 2020-10-29 15:38    [W:0.095 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site