From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755798Ab0IWQu0 (ORCPT ); Thu, 23 Sep 2010 12:50:26 -0400 Received: from spaceboyz.net ([87.106.131.203]:45079 "EHLO spaceboyz.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755692Ab0IWQuY (ORCPT ); Thu, 23 Sep 2010 12:50:24 -0400 Date: Thu, 23 Sep 2010 18:49:44 +0200 From: David Lamparter To: "Eric W. Biederman" Cc: David Lamparter , linux-kernel@vger.kernel.org, Linux Containers , netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, jamal , Daniel Lezcano , Linus Torvalds , Michael Kerrisk , Ulrich Drepper , Al Viro , David Miller , "Serge E. Hallyn" , Pavel Emelyanov , Pavel Emelyanov , Ben Greear , Matt Helsley , Jonathan Corbet , Sukadev Bhattiprolu , Jan Engelhardt , Patrick McHardy Subject: Re: [ABI REVIEW][PATCH 0/8] Namespace file descriptors Message-ID: <20100923164944.GA1202237@jupiter.n2.diac24.net> References: <20100923151853.GC1160234@jupiter.n2.diac24.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 23, 2010 at 09:32:29AM -0700, Eric W. Biederman wrote: > > At several occasions, I was left with either some runaway daemon which > > kept the namespace alive. To describe this a little more graphically: > > I found no other way than doing a > > md5sum /proc/*/net/if_inet6 | sort | uniq -c -w 32 > > to find out which runaway to kill to terminate the namespace. > > > > This makes network namespaces particularly cumbersome to use without PID > > namespaces. While I agree that a large part of the users - namely lxc - > > will use them together, network namespaces without pidns are very > > interesting for routing applications implementing VRFs. > > > > Is it possible to add some kind of "all namespaces" list, optimally > > giving an opportunity to open() exactly this file descriptor that you > > get from /proc//ns/net? > > > > Also, is it possible to extend that file descriptor to have an > > "get all pids" ioctl, > > ...or, wait, maybe have /proc/...ns/proc/ symlink? > > > > (This obviously isn't fully thought to the end, please pick up...) > > Maybe. I can understand the pain. > > Is the problem you are facing you are shutting down a vrf and you want > to make certain nothing is using it any longer? Hrm. There are 2 and a half problems i can describe: 1) identifying namespaces. You can walk over /proc just fine and look at all processes namespaces, but you don't know which are actually the same aside from looking at some entry like if_inet6. There is no identifier and no easy equality match. (As far as i can tell.) Bonus difficulty: your patch will allow namespaces that have no process attached to them anymore since they only exist as files. Those will be invisible to someone running through /proc. Which leads to: 2) enumerating namespaces. Sure you can walk through /proc, but that's racy and won't even work with fd-only namespaces. It might even be a security risk if some trojan creates, say, a VLAN on your eth0, or a macvlan, hides it in a network namespace and communicates through it. 2 1/2) is terminating a namespace. It's not really a problem to add a PID namespace when you have "uncontrollable" daemons; however you can't be sure whether someone else took a reference on the network namespace from the outside. These all are mainly administration/management issues, not that much regular operation. Writing routing software with VRF support works just fine, but the sysadmin can be at somewhat of an odd end here. -David