From: David Miller <davem@davemloft.net>
To: kraigatgoog@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] soreuseport: fix initialization race
Date: Sun, 22 Oct 2017 02:04:26 +0100 (WEST) [thread overview]
Message-ID: <20171022.020426.437301151304003338.davem@davemloft.net> (raw)
In-Reply-To: <20171019190029.163693-1-kraigatgoog@gmail.com>
From: Craig Gallek <kraigatgoog@gmail.com>
Date: Thu, 19 Oct 2017 15:00:29 -0400
> From: Craig Gallek <kraig@google.com>
>
> Syzkaller stumbled upon a way to trigger
> WARNING: CPU: 1 PID: 13881 at net/core/sock_reuseport.c:41
> reuseport_alloc+0x306/0x3b0 net/core/sock_reuseport.c:39
>
> There are two initialization paths for the sock_reuseport structure in a
> socket: Through the udp/tcp bind paths of SO_REUSEPORT sockets or through
> SO_ATTACH_REUSEPORT_[CE]BPF before bind. The existing implementation
> assumedthat the socket lock protected both of these paths when it actually
> only protects the SO_ATTACH_REUSEPORT path. Syzkaller triggered this
> double allocation by running these paths concurrently.
>
> This patch moves the check for double allocation into the reuseport_alloc
> function which is protected by a global spin lock.
>
> Fixes: e32ea7e74727 ("soreuseport: fast reuseport UDP socket selection")
> Fixes: c125e80b8868 ("soreuseport: fast reuseport TCP socket selection")
> Signed-off-by: Craig Gallek <kraig@google.com>
Applied and queued up for -stable.
prev parent reply other threads:[~2017-10-22 1:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 19:00 [PATCH net] soreuseport: fix initialization race Craig Gallek
2017-10-22 1:04 ` David Miller [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=20171022.020426.437301151304003338.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=kraigatgoog@gmail.com \
--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).