[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140611.153954.494439641088532676.davem@davemloft.net>
Date: Wed, 11 Jun 2014 15:39:54 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: preobr@...gle.com, dormando@...ia.net,
steffen.klassert@...unet.com, paulmck@...ux.vnet.ibm.com,
netdev@...r.kernel.org, kcc@...gle.com, dvyukov@...gle.com,
larsbull@...gle.com, edumazet@...gle.com, brutus@...gle.com,
maze@...gle.com, alexei.starovoitov@...il.com
Subject: Re: [PATCH] ipv4: fix a race in ip4_datagram_release_cb()
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Tue, 10 Jun 2014 06:43:01 -0700
> From: Eric Dumazet <edumazet@...gle.com>
>
> Alexey gave a AddressSanitizer[1] report that finally gave a good hint
> at where was the origin of various problems already reported by Dormando
> in the past [2]
>
> Problem comes from the fact that UDP can have a lockless TX path, and
> concurrent threads can manipulate sk_dst_cache, while another thread,
> is holding socket lock and calls __sk_dst_set() in
> ip4_datagram_release_cb() (this was added in linux-3.8)
>
> It seems that all we need to do is to use sk_dst_check() and
> sk_dst_set() so that all the writers hold same spinlock
> (sk->sk_dst_lock) to prevent corruptions.
>
> TCP stack do not need this protection, as all sk_dst_cache writers hold
> the socket lock.
>
> [1]
> https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel
...
> Reported-by: Alexey Preobrazhensky <preobr@...gle.com>
> Reported-by: dormando <dormando@...ia.ne>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Fixes: 8141ed9fcedb2 ("ipv4: Add a socket release callback for datagram sockets")
Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists