Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755346AbbKXWMn (ORCPT ); Tue, 24 Nov 2015 17:12:43 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:33979 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbbKXWMh (ORCPT ); Tue, 24 Nov 2015 17:12:37 -0500 MIME-Version: 1.0 In-Reply-To: References: <5654D6D9.1050108@akamai.com> <20151124214512.GM27046@kvack.org> Date: Tue, 24 Nov 2015 14:12:35 -0800 Message-ID: Subject: Re: use-after-free in sock_wake_async From: Eric Dumazet To: Benjamin LaHaise Cc: Jason Baron , Dmitry Vyukov , "David S. Miller" , Hannes Frederic Sowa , Al Viro , David Howells , Ying Xue , "Eric W. Biederman" , Rainer Weikusat , netdev , LKML , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1165 Lines: 28 On Tue, Nov 24, 2015 at 2:03 PM, Eric Dumazet wrote: > > This might be a data race in sk_wake_async() if inlined by compiler > (see https://lkml.org/lkml/2015/11/24/680 for another example) > > KASAN adds register pressure and compiler can then do 'stupid' things :( > > diff --git a/include/net/sock.h b/include/net/sock.h > index 7f89e4ba18d1..2af6222ccc67 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -2008,7 +2008,7 @@ static inline unsigned long sock_wspace(struct sock *sk) > static inline void sk_wake_async(struct sock *sk, int how, int band) > { > if (sock_flag(sk, SOCK_FASYNC)) > - sock_wake_async(sk->sk_socket, how, band); > + sock_wake_async(READ_ONCE(sk->sk_socket), how, band); > } > > /* Since sk_{r,w}mem_alloc sums skb->truesize, even a small frame might Oh well, sock_wake_async() can not be inlined, scratch this. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/