From: Dominique Martinet <asmadeus@codewreck.org>
To: Tomas Bortoli <tomasbortoli@gmail.com>
Cc: davem@davemloft.net, v9fs-developer@lists.sourceforge.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller@googlegroups.com
Subject: Re: [PATCH] 9p: fix Use-After-Free in p9_write_work()
Date: Mon, 30 Jul 2018 12:23:49 +0200 [thread overview]
Message-ID: <20180730102349.GA31932@nautica> (raw)
In-Reply-To: <4ac26f97-778b-6527-9a5b-08b7bfc8a5e8@gmail.com>
Tomas Bortoli wrote on Mon, Jul 30, 2018:
> > Other transports also have the same issue see discussion in
> > https://lkml.org/lkml/2018/7/19/727
> > (that is another syzbot report, slightly different but I believe it
> > points to the same issue)
> >
> > Basically, a more global view of the problem is a race between
> > p9_tag_lookup returning a p9_req_t and another thread freeing it.
> >
> > Matthew wrote the problem himself in a comment in p9_tag_lookup in his new
> > version that used to be in linux-next at the time (I took the commit out
> > temporarily until I've had time to benchmark it, but it will come back in,
> > just you're working on thin air right now because the bug was only found
> > thanks to this commit):
> > + /* There's no refcount on the req; a malicious server could
> > cause
> > + * us to dereference a NULL pointer
> > + */
> >
> > So a more proper solution would be to had a refcount to req, have
> > p9_tag_lookup increment the refcount within rcu_read_lock, and have a
> > deref function free the req when the count hits 0.
>
> Which commit ? that's a comment.
Sorry, the commit is this one:
http://lkml.kernel.org/r/20180711210225.19730-6-willy@infradead.org
It's now out of my 9p-next branch due to performance reasons but I'll
definitely take it back in once my performance mitigation patches have
had a few reviews.
> That sound like the proper solution. Let's do it that way then.
Cool :)
--
Dominique
prev parent reply other threads:[~2018-07-30 10:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 13:02 [PATCH] 9p: fix Use-After-Free in p9_write_work() Tomas Bortoli
2018-07-29 23:33 ` Dominique Martinet
2018-07-30 0:18 ` [V9fs-developer] " Dominique Martinet
2018-07-30 5:54 ` Dmitry Vyukov
2018-07-30 6:00 ` Dominique Martinet
2018-07-30 9:45 ` Tomas Bortoli
2018-07-30 10:23 ` Dominique Martinet [this message]
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=20180730102349.GA31932@nautica \
--to=asmadeus@codewreck.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
--cc=tomasbortoli@gmail.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).