lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008153533.r43qyvasfqahmq6f@wittgenstein>
Date:   Tue, 8 Oct 2019 17:35:35 +0200
From:   Christian Brauner <christian.brauner@...ntu.com>
To:     Andrea Parri <parri.andrea@...il.com>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>, bsingharora@...il.com,
        Marco Elver <elver@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        syzbot <syzbot+c5d03165a1bd1dead0c1@...kaller.appspotmail.com>,
        syzkaller-bugs <syzkaller-bugs@...glegroups.com>,
        stable <stable@...r.kernel.org>
Subject: Re: [PATCH v2] taskstats: fix data-race

On Tue, Oct 08, 2019 at 05:26:59PM +0200, Andrea Parri wrote:
> On Tue, Oct 08, 2019 at 04:24:14PM +0200, Christian Brauner wrote:
> > On Tue, Oct 08, 2019 at 04:20:35PM +0200, Andrea Parri wrote:
> > > On Mon, Oct 07, 2019 at 04:18:26PM +0200, Dmitry Vyukov wrote:
> > > > On Mon, Oct 7, 2019 at 4:14 PM Andrea Parri <parri.andrea@...il.com> wrote:
> > > > >
> > > > > > > >  static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)
> > > > > > > >  {
> > > > > > > >       struct signal_struct *sig = tsk->signal;
> > > > > > > > -     struct taskstats *stats;
> > > > > > > > +     struct taskstats *stats_new, *stats;
> > > > > > > >
> > > > > > > > -     if (sig->stats || thread_group_empty(tsk))
> > > > > > > > -             goto ret;
> > > > > > > > +     /* Pairs with smp_store_release() below. */
> > > > > > > > +     stats = READ_ONCE(sig->stats);
> > > > > > >
> > > > > > > This pairing suggests that the READ_ONCE() is heading an address
> > > > > > > dependency, but I fail to identify it: what is the target memory
> > > > > > > access of such a (putative) dependency?
> > > > > >
> > > > > > I would assume callers of this function access *stats. So the
> > > > > > dependency is between loading stats and accessing *stats.
> > > > >
> > > > > AFAICT, the only caller of the function in 5.4-rc2 is taskstats_exit(),
> > > > > which 'casts' the return value to a boolean (so I really don't see how
> > > > > any address dependency could be carried over/relied upon here).
> > > > 
> > > > This does not make sense.
> > > > 
> > > > But later taskstats_exit does:
> > > > 
> > > > memcpy(stats, tsk->signal->stats, sizeof(*stats));
> > > > 
> > > > Perhaps it's supposed to use stats returned by taskstats_tgid_alloc?
> > > 
> > > Seems reasonable to me.  If so, replacing the READ_ONCE() in question
> > > with an smp_load_acquire() might be the solution.  Thoughts?
> > 
> > I've done that already in my tree yesterday. I can resend for another
> > review if you'd prefer.
> 
> Oh nice!  No need to resend of course.  ;D FWIW, I can check it if you
> let me know the particular branch/commit (guessing that's somewhere in
> git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git, yes?).

Oh ups, yeah of course :)
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=taskstats_syzbot

Thanks!
Christian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ