From: "Paul E. McKenney" <paulmck@kernel.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>,
Kostya Serebryany <kcc@google.com>,
LKML <linux-kernel@vger.kernel.org>,
kasan-dev <kasan-dev@googlegroups.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@google.com>,
'Dmitry Vyukov' via syzkaller-upstream-moderation
<syzkaller-upstream-moderation@googlegroups.com>,
Jann Horn <jannh@google.com>
Subject: Re: Finally starting on short RCU grace periods, but...
Date: Thu, 6 Aug 2020 06:35:57 -0700 [thread overview]
Message-ID: <20200806133557.GM4295@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <CACT4Y+aF=Y-b7Lm7+UAD7Zb1kS1uWF+G_3yBbXsY6YO3k2dBuw@mail.gmail.com>
On Thu, Aug 06, 2020 at 03:25:57PM +0200, Dmitry Vyukov wrote:
> On Thu, Aug 6, 2020 at 3:22 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> >
> > On Thu, Aug 6, 2020 at 12:31 PM Marco Elver <elver@google.com> wrote:
> > >
> > > +Cc kasan-dev
Thank you!
> > > On Thu, 6 Aug 2020 at 01:08, Paul E. McKenney <paulmck@kernel.org> wrote:
> > > >
> > > > Hello!
> > > >
> > > > If I remember correctly, one of you asked for a way to shorten RCU
> > > > grace periods so that KASAN would have a better chance of detecting bugs
> > > > such as pointers being leaked out of RCU read-side critical sections.
> > > > I am finally starting entering and testing code for this, but realized
> > > > that I had forgotten a couple of things:
> > > >
> > > > 1. I don't remember exactly who asked, but I suspect that it was
> > > > Kostya. I am using his Reported-by as a placeholder for the
> > > > moment, but please let me know if this should be adjusted.
> > >
> > > It certainly was not me.
> > >
> > > > 2. Although this work is necessary to detect situtions where
> > > > call_rcu() is used to initiate a grace period, there already
> > > > exists a way to make short grace periods that are initiated by
> > > > synchronize_rcu(), namely, the rcupdate.rcu_expedited kernel
> > > > boot parameter. This will cause all calls to synchronize_rcu()
> > > > to act like synchronize_rcu_expedited(), resulting in about 2-3
> > > > orders of magnitude reduction in grace-period latency on small
> > > > systems (say 16 CPUs).
> > > >
> > > > In addition, I plan to make a few other adjustments that will
> > > > increase the probability of KASAN spotting a pointer leak even in the
> > > > rcupdate.rcu_expedited case.
> > >
> > > Thank you, that'll be useful I think.
> > >
> > > > But if you would like to start this sort of testing on current mainline,
> > > > rcupdate.rcu_expedited is your friend!
> >
> > Hi Paul,
> >
> > This is great!
> >
> > I understand it's not a sufficiently challenging way of tracking
> > things, but it's simply here ;)
> > https://bugzilla.kernel.org/show_bug.cgi?id=208299
> > (now we also know who asked for this, +Jann)
Thank you, and I will update the Reported-by lines accordingly.
> > I've tested on the latest mainline and with rcupdate.rcu_expedited=1
> > it boots to ssh successfully and I see:
> > [ 0.369258][ T0] All grace periods are expedited (rcu_expedited).
> >
> > I have created https://github.com/google/syzkaller/pull/2021 to enable
> > it on syzbot.
> > On syzbot we generally use only 2-4 CPUs per VM, so it should be even better.
Sounds good, and perhaps this will answer Marco's question below. ;-)
> > > Do any of you remember some bugs we missed due to this? Can we find
> > > them if we add this option?
> >
> > The problem is that it's hard to remember bugs that were not caught :)
> > Here is an approximation of UAFs with free in rcu callback:
> > https://groups.google.com/forum/#!searchin/syzkaller-bugs/KASAN$20use-after-free$20rcu_do_batch%7Csort:date
> > The ones with low hit count are the ones that we almost did not catch.
> > That's the best estimation I can think of. Also potentially we can get
> > reproducers for such bugs without reproducers.
> > Maybe we will be able to correlate some bugs/reproducers that appear
> > soon with this change.
>
> Wait, it was added in 2012?
> https://github.com/torvalds/linux/commit/3705b88db0d7cc4
Indeed it was, which is my current excuse for having failed to immediately
mention it to Jann during our IRC discussion.
The purpose back then was to make battery-powered systems go faster,
I think mostly focused on CPU hotplug operations. At least that would
explain the commit log being indefinite on the exact benefit. ;-)
Thanx, Paul
next prev parent reply other threads:[~2020-08-06 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 23:08 Paul E. McKenney
2020-08-06 10:31 ` Marco Elver
2020-08-06 13:22 ` Dmitry Vyukov
2020-08-06 13:25 ` Dmitry Vyukov
2020-08-06 13:35 ` Paul E. McKenney [this message]
2020-08-06 20:58 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200806133557.GM4295@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=jannh@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-upstream-moderation@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®