Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599AbbLMUnP (ORCPT ); Sun, 13 Dec 2015 15:43:15 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33459 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752201AbbLMUnN (ORCPT ); Sun, 13 Dec 2015 15:43:13 -0500 Message-ID: <1450039390.9768.30.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations From: Eric Dumazet To: Ben Hutchings Cc: Luis Henriques , Eric Dumazet , Steffen Klassert , "David S. Miller" , linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Date: Sun, 13 Dec 2015 12:43:10 -0800 In-Reply-To: <1450038035.3944.2.camel@decadent.org.uk> References: <1449653896-5236-1-git-send-email-luis.henriques@canonical.com> <1449653896-5236-10-git-send-email-luis.henriques@canonical.com> <1449893906.3836.5.camel@decadent.org.uk> <20151213185429.GA31826@charon> <1450038035.3944.2.camel@decadent.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2278 Lines: 64 On Sun, 2015-12-13 at 20:20 +0000, Ben Hutchings wrote: > On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote: > > On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote: > > > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote: > > > > 3.16.7-ckt21 -stable review patch. If anyone has any objections, > > > > please let me know. > > > > > > > > ------------------ > > > > > > > > From: Eric Dumazet > > > > > > > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream. > > > > > > > > sit0 device allocates its percpu storage twice : > > > > - One time in ipip6_tunnel_init() > > > > - One time in ipip6_fb_tunnel_init() > > > > > > > > Thus we leak 48 bytes per possible cpu per network namespace > > > > dismantle. > > > > > > > > ipip6_fb_tunnel_init() can be much simpler and does not > > > > return an error, and should be called after register_netdev() > > > [...] > > > > > > Doesn't this introduce a race condition when sit is a module? There > > > seems to be nothing to prevent access to the partially initialised > > > device after calling register_netdev(), if sit_init_net() is called > > > during module loading rather than during namespace creation. > > > > > > > This seems to be an upstream issue, not specific to the 3.16.y-ckt > > stable kernel. If that is the case, I guess I'll just keep this patch > > and later apply the fix. Or do you think this race is really likely > > to be a worst problem than then issue the patch is trying to fix? > > It seems worse than the problem being fixed. 1) Sorry Ben, I do not understand the problem you mention. What is a partially initialized device exactly ? 2) I have no idea why this patch is even backported to 3.16, since it is fixing a problem added in 3.18 : # git describe --contains ebe084aafb7e v3.18-rc5~22^2~42^2~1 If your 3.16 kernel survives this loop without consuming memory like crazy, then the backport is not needed. modprobe sit while : do ip netns add ns1 ip netns delete ns1 done -- 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/