[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fc0ae94f5554c6ea320dba1d6fe84aa@AcuMS.aculab.com>
Date: Tue, 10 Oct 2023 08:42:32 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'Eric W. Biederman'" <ebiederm@...ssion.com>,
Toke Høiland-Jørgensen <toke@...hat.com>
CC: David Ahern <dsahern@...il.com>, Stephen Hemminger
<stephen@...workplumber.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Christian Brauner <brauner@...nel.org>
Subject: RE: [RFC PATCH iproute2-next 0/5] Persisting of mount namespaces
along with network namespaces
From: Eric W. Biederman
> Sent: 09 October 2023 21:33
>
> Toke Høiland-Jørgensen <toke@...hat.com> writes:
>
> > The 'ip netns' command is used for setting up network namespaces with persistent
> > named references, and is integrated into various other commands of iproute2 via
> > the -n switch.
> >
> > This is useful both for testing setups and for simple script-based namespacing
> > but has one drawback: the lack of persistent mounts inside the spawned
> > namespace. This is particularly apparent when working with BPF programs that use
> > pinning to bpffs: by default no bpffs is available inside a namespace, and
> > even if mounting one, that fs disappears as soon as the calling
> > command exits.
>
> It would be entirely reasonable to copy mounts like /sys/fs/bpf from the
> original mount namespace into the temporary mount namespace used by
> "ip netns".
>
> I would call it a bug that "ip netns" doesn't do that already.
>
> I suspect that "ip netns" does copy the mounts from the old sysfs onto
> the new sysfs is your entire problem.
When I was getting a program to run in multiple network namespaces
(has sockets in 2 namespaces) I rather expected that netns(net_ns_fd,0)
would 'magically' change /proc/net to refer to the new namespace.
I think that could be done in the code that follows the /proc/net
mountpoint - IIRC something similar is done for /proc/self.
However that would need flags to both setns() and 'ip netns exec'
since programs will rely on the existing behaviour.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists