From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
John Fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCH net-next] ptr_ring: fix integer overflow
Date: Fri, 26 Jan 2018 15:51:01 +0200 [thread overview]
Message-ID: <20180126154927-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <29dd0d30-07e7-0432-2ad8-209a2ed35e5a@redhat.com>
On Fri, Jan 26, 2018 at 11:44:22AM +0800, Jason Wang wrote:
>
>
> On 2018年01月26日 01:31, Michael S. Tsirkin wrote:
> > On Thu, Jan 25, 2018 at 10:17:38PM +0800, Jason Wang wrote:
> > >
> > > On 2018年01月25日 21:45, Michael S. Tsirkin wrote:
> > > > On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote:
> > > > > We try to allocate one more entry for lockless peeking. The adding
> > > > > operation may overflow which causes zero to be passed to kmalloc().
> > > > > In this case, it returns ZERO_SIZE_PTR without any notice by ptr
> > > > > ring. Try to do producing or consuming on such ring will lead NULL
> > > > > dereference. Fix this detect and fail early.
> > > > >
> > > > > Fixes: bcecb4bbf88a ("net: ptr_ring: otherwise safe empty checks can overrun array bounds")
> > > > > Reported-by:syzbot+87678bcf753b44c39b67@syzkaller.appspotmail.com
> > > > > Cc: John Fastabend<john.fastabend@gmail.com>
> > > > > Signed-off-by: Jason Wang<jasowang@redhat.com>
> > > > Ugh that's just way too ugly.
> > > > I'll work on dropping the extra + 1 - but calling this
> > > > function with -1 size is the real source of the bug.
> > > > Do you know how come we do that?
> > > >
> > > It looks e.g try to change tx_queue_len to UINT_MAX. And we probably can't
> > > prevent user form trying to do this?
> > >
> > > Thanks
> > Right. BTW why net-next? Isn't the crash exploitable in net?
> >
>
> Commit bcecb4bbf88a exists only in net-next.
Right you are.
> And in net we check r->size
> before trying to dereference the queue.
>
> Thanks
I was wondering what it's about btw. Does anyone really create 0 size rings?
--
MST
next prev parent reply other threads:[~2018-01-26 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 7:31 [PATCH net-next] ptr_ring: fix integer overflow Jason Wang
2018-01-25 13:45 ` Michael S. Tsirkin
2018-01-25 14:17 ` Jason Wang
2018-01-25 17:31 ` Michael S. Tsirkin
2018-01-26 3:44 ` Jason Wang
2018-01-26 13:51 ` Michael S. Tsirkin [this message]
2018-01-29 17:01 ` David Miller
2018-01-30 6:56 ` Jason Wang
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=20180126154927-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).