From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: sploving1@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH net] udp: must lock the socket in udp_disconnect()
Date: Thu, 20 Oct 2016 14:46:10 -0400 (EDT) [thread overview]
Message-ID: <20161020.144610.532749573029633695.davem@davemloft.net> (raw)
In-Reply-To: <1476981580.7065.15.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 20 Oct 2016 09:39:40 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Baozeng Ding reported KASAN traces showing uses after free in
> udp_lib_get_port() and other related UDP functions.
>
> A CONFIG_DEBUG_PAGEALLOC=y kernel would eventually crash.
>
> I could write a reproducer with two threads doing :
>
> static int sock_fd;
> static void *thr1(void *arg)
> {
> for (;;) {
> connect(sock_fd, (const struct sockaddr *)arg,
> sizeof(struct sockaddr_in));
> }
> }
>
> static void *thr2(void *arg)
> {
> struct sockaddr_in unspec;
>
> for (;;) {
> memset(&unspec, 0, sizeof(unspec));
> connect(sock_fd, (const struct sockaddr *)&unspec,
> sizeof(unspec));
> }
> }
>
> Problem is that udp_disconnect() could run without holding socket lock,
> and this was causing list corruptions.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Baozeng Ding <sploving1@gmail.com>
Applied, sounds like I should queue this up for -stable too right?
next prev parent reply other threads:[~2016-10-20 18:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 13:46 BUG: KASAN: use-after-free in udp_lib_get_port Baozeng Ding
2016-10-16 19:53 ` Cong Wang
2016-10-19 7:36 ` Baozeng Ding
2016-10-19 15:01 ` Baozeng Ding
2016-10-20 6:25 ` Eric Dumazet
2016-10-20 16:39 ` [PATCH net] udp: must lock the socket in udp_disconnect() Eric Dumazet
2016-10-20 18:46 ` David Miller [this message]
2016-10-20 20:44 ` Eric Dumazet
2016-10-21 1:12 ` Cong Wang
2016-10-21 2:09 ` Eric Dumazet
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=20161020.144610.532749573029633695.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sploving1@gmail.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;
as well as URLs for NNTP newsgroup(s).