[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXaGBs_1j_fv894h=xrfdBLt57MM9i+YH_PDR3GDteoQQ@mail.gmail.com>
Date: Mon, 22 Jun 2015 09:26:13 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Borislav Petkov <bp@...en8.de>
Cc: Kees Cook <keescook@...omium.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...hat.com>,
Denys Vlasenko <vda.linux@...glemail.com>,
Brian Gerst <brgerst@...il.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
X86 ML <x86@...nel.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH v2 03/14] notifiers: Assert that RCU is watching in notify_die
On Jun 22, 2015 4:37 AM, "Borislav Petkov" <bp@...en8.de> wrote:
>
> On Thu, Jun 18, 2015 at 12:08:35PM -0700, Andy Lutomirski wrote:
> > Low-level arch entries often call notify_die, and it's easy for arch
> > code to fail to exit an RCU quiescent state first. Assert that
> > we're not quiescent in notify_die.
> >
> > Signed-off-by: Andy Lutomirski <luto@...nel.org>
> > ---
> > kernel/notifier.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/kernel/notifier.c b/kernel/notifier.c
> > index ae9fc7cc360e..980e4330fb59 100644
> > --- a/kernel/notifier.c
> > +++ b/kernel/notifier.c
> > @@ -544,6 +544,8 @@ int notrace notify_die(enum die_val val, const char *str,
> > .signr = sig,
> >
> > };
> > + rcu_lockdep_assert(rcu_is_watching(),
> > + "notify_die called but RCU thinks we're quiescent");
> > return atomic_notifier_call_chain(&die_chain, val, &args);
> > }
>
> Ok, we're about to die and we will prepend what would be a more
> important splat possibly hinting at the problem is with a lockdep splat.
>
> I think we should do the assertion and make the rcu_lockdep splat come
> last I but don't see how to do this easily from all the notify_die()
> call sites.
>
> Or am I missing something...?
notify_die is misnamed and has little to do with death. It's really
just notifying about an exception, and we might end up oopsing,
sending a signal, or neither.
It's unfortunate that context tracking state isn't nmi-safe, forcing
us to differentiate rcu_is_watching (set by rcu_nmi_enter) from
ct_state() != CONTEXT_USER.
Also, I just realized that this whole series has a minor issue in that
there's a race where an IRQ hits after syscall entry but before
context tracking. I'll fix it up. (I think the impact is limited to
a warning.)
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists