Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751925AbdCIEvD (ORCPT ); Wed, 8 Mar 2017 23:51:03 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:36407 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbdCIEvB (ORCPT ); Wed, 8 Mar 2017 23:51:01 -0500 MIME-Version: 1.0 In-Reply-To: <1489034454.28631.21.camel@edumazet-glaptop3.roam.corp.google.com> References: <1489022121-20571-1-git-send-email-jmaxwell37@gmail.com> <1489025457.28631.19.camel@edumazet-glaptop3.roam.corp.google.com> <1489034454.28631.21.camel@edumazet-glaptop3.roam.corp.google.com> From: Jonathan Maxwell Date: Thu, 9 Mar 2017 15:47:16 +1100 Message-ID: Subject: Re: [PATCH net] dccp/tcp: fix routing redirect race To: Eric Dumazet Cc: gerrit@erg.abdn.ac.uk, David Miller , Eric Dumazet , Andrey Konovalov , kuznet , jmorris , yoshfuji , kaber , Neal Cardwell , dccp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jon Maxwell , Eric Garver , Hannes Sowa 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: 1106 Lines: 37 On Thu, Mar 9, 2017 at 3:40 PM, Eric Dumazet wrote: > On Thu, 2017-03-09 at 14:42 +1100, Jonathan Maxwell wrote: >> Sorry let me resend in plain text mode. >> >> On Thu, Mar 9, 2017 at 1:10 PM, Eric Dumazet wrote: >> > On Thu, 2017-03-09 at 12:15 +1100, Jon Maxwell wrote: >> >> We have seen a few incidents lately where a dst_enty has been freed >> >> with a dangling TCP socket reference (sk->sk_dst_cache) pointing to that >> >> dst_entry. If the conditions/timings are right a crash then ensues when the >> >> freed dst_entry is referenced later on. A Common crashing back trace is: >> > >> > Very nice catch ! >> > >> >> Thanks Eric. >> >> > Don't we have a similar issue for IPv6 ? >> > >> > >> >> Good point. >> >> We checked and as far as we can tell IPv6 does not invalidate the route. >> So it should be safer. > > Simply doing : > > __sk_dst_check(sk, np->dst_cookie); > > is racy, even before calling dst->ops->redirect(dst, sk, skb); > > (if socket is owned by user) > > > Okay, I will add a similar patch for IPv6 to also protect from that.