lkml.org 
[lkml]   [2020]   [Oct]   [30]   [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 Fri 2020-10-30 10:48:58, Miroslav Benes wrote:
> > > > > + 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.
> > >
> > > Yeah, the early return might break the consistency model and
> > > unexpected things might happen. We should be aware of it.
> > > Please use:
> > >
> > > if (WARN_ON_ONCE(bit < 0))
> > > return;
> > >
> > > WARN_ON_ONCE() might be part of the recursion. But it should happen
> > > only once. IMHO, it is worth the risk.
> > >
> > > Otherwise it looks good.
> >
> > Perhaps we can add that as a separate patch, because this patch doesn't add
> > any real functionality change. It only moves the recursion testing from the
> > helper function (which ftrace wraps all callbacks that do not have the
> > RECURSION flags set, including this one) down to your callback.
> >
> > In keeping with one patch to do one thing principle, the added of
> > WARN_ON_ONCE() should be a separate patch, as that will change the
> > functionality.
> >
> > If that WARN_ON_ONCE() breaks things, I'd like it to be bisected to another
> > patch other than this one.
>
> Works for me.

+1

So, with the updated commit message:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

\
 
 \ /
  Last update: 2020-10-30 11:42    [W:0.043 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site