[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161020.144610.532749573029633695.davem@davemloft.net>
Date: Thu, 20 Oct 2016 14:46:10 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: sploving1@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net] udp: must lock the socket in udp_disconnect()
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 20 Oct 2016 09:39:40 -0700
> From: Eric Dumazet <edumazet@...gle.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@...gle.com>
> Reported-by: Baozeng Ding <sploving1@...il.com>
Applied, sounds like I should queue this up for -stable too right?
Powered by blists - more mailing lists