LWN: Comments on "Namespaces in operation, part 2: the namespaces API" https://lwn.net/Articles/531381/ This is a special feed containing comments posted to the individual LWN article titled "Namespaces in operation, part 2: the namespaces API". en-us Thu, 21 Aug 2025 23:53:39 +0000 Thu, 21 Aug 2025 23:53:39 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/810938/ https://lwn.net/Articles/810938/ mkerrisk <div class="FormattedComment"> <font class="QuotedText">&gt; I presume the answer is yes, and the new </font><br> <font class="QuotedText">&gt; /proc/PID just winds up with a completely</font><br> <font class="QuotedText">&gt; unrelated inode from the old one.</font><br> <p> That's correct.<br> </div> Thu, 30 Jan 2020 01:09:23 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/635320/ https://lwn.net/Articles/635320/ apollock <div class="FormattedComment"> I'm curious. If you bind mount the /proc/PID/ns/uts entry, and then the original process goes away, is that PID available for reuse?<br> <p> I presume the answer is yes, and the new /proc/PID just winds up with a completely unrelated inode from the old one.<br> </div> Tue, 03 Mar 2015 06:40:29 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/635251/ https://lwn.net/Articles/635251/ mkerrisk One point to note regarding the <tt>unshare.c</tt> experiment with mount namespaces (shown toward the end of the article)... These days, some distributions (e.g., Fedora) enable mount event propagation (<i>mount --make-shared</i>) by default, so that an unmount in the second namespace would automatically affect the initial namespace as well. To prevent mount event propagation, we need to make / a private mount in the second namespace. See the following example: <pre> $ <strong>echo $$</strong> # Show PID of shell in initial mount NS 989 $ <strong>readlink /proc/989/ns/mnt</strong> mnt:[4026531840] $ <strong>cat /proc/989/mounts | awk '/test/ { print $1 , $2 , $3}'</strong> /dev/sda3 /test ext4 $ <strong>PS1='$sh2 ' sudo ./unshare -m /bin/bash</strong> # Start a new shell in a new mount NS sh2$ <strong>readlink /proc/$$/ns/mnt</strong> # Verify that shell is in different mount NS mnt:[4026532640] sh2$ # Check whether / mount point propagates mount events sh2$ <strong>cat /proc/$$/mountinfo | awk '/\/ \/ / {print $4, $5, $6, $7}'</strong> / / rw,relatime <strong><font color="red">shared:1</font></strong> sh2$ <strong>sudo mount --make-private /</strong> # Prevent propagation of events for / sh2$ <strong>cat /proc/$$/mountinfo | awk '/\/ \/ / {print $4, $5, $6, $7}'</strong> / / rw,relatime <strong><font color="red">-</font></strong> sh2$ <strong>sudo umount /test</strong> # Unmount /test in second mount NS sh2$ Verify that mount has been removed in second mount NS sh2$ <strong>cat /proc/$$/mounts | awk '/test/ { print $1 , $2 , $3}'</strong> sh2$ Verify that mount is still present in initial mount NS sh2$ <strong>cat /proc/989/mounts | awk '/test/ { print $1 , $2 ,$3}'</strong> /dev/sda3 /test ext4 </pre> For more info about mount propagation, see the kernel source file <tt>Documentation/filesystems/sharedsubtree.txt</tt> and the <tt>mount(8)</tt> man page. Mon, 02 Mar 2015 12:08:29 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/548749/ https://lwn.net/Articles/548749/ mathstuf <div class="FormattedComment"> Anything that ships with XFS enabled (pretty much any distro) can't support user namespaces yet since XFS won't work with them. You're probably stuck compiling your own for now (which is what I did and then tossed it into a VM).<br> </div> Sat, 27 Apr 2013 20:38:31 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/548736/ https://lwn.net/Articles/548736/ wkevils <div class="FormattedComment"> Did anybody tried the example with the mount namespaces ? <br> <p> I tried it both on Fedora 18 and Ubuntu 12.10 and it did not <br> work.<br> For Fedora 18, it could be because of the shared flags.<br> (running cat /proc/$$/mountinfo show shared).<br> <p> But for ubuntu:<br> cat /proc/$$/mountinfo |grep shared<br> gives nothing.<br> <p> I would appreciate if someone that tested it and it worked <br> will post which OS and which kernel he uses.<br> <p> rgs<br> Kevin Wilson<br> <p> <p> </div> Sat, 27 Apr 2013 15:50:36 +0000 setns syscall via syscall() https://lwn.net/Articles/533162/ https://lwn.net/Articles/533162/ bourbaki <div class="FormattedComment"> If your libc is too old and and does not have the setns() wrapper for the sys_setns syscall, you can use the syscall() function instead (in &lt;sys/syscall.h&gt;).<br> <p> On x86_64, the sys_setns syscall number is 308, so in ns_exec.c you can do :<br> <p> syscall(308,fd,0)<br> <p> instead of<br> <p> setns(fd,0)<br> </div> Fri, 18 Jan 2013 09:15:45 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/532890/ https://lwn.net/Articles/532890/ kevinm <div class="FormattedComment"> So with a VPN (or IPv6 tunnel) endpoint that uses TUN/TAP, you could bring up your VPN and pingflood away to your heart's content.<br> </div> Thu, 17 Jan 2013 03:03:55 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/532372/ https://lwn.net/Articles/532372/ tpo <div class="FormattedComment"> What a wonderful article.<br> <p> It clearly and comprehensively explains the basics and the use in practice, is technical and easy to read.<br> <p> Thanks Michael!<br> *t<br> </div> Fri, 11 Jan 2013 11:19:02 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/531966/ https://lwn.net/Articles/531966/ hallyn <div class="FormattedComment"> <font class="QuotedText">&gt; eg if you create a new user ns and new netns can you say use ping or other root-requiring network ops?</font><br> <p> Yes - but only with nics owned by your new network namespace. Which means nics which you create (which won't be hooked into the parent ns), or nics which a privileged task in the parent netns passed into your ns.<br> <p> </div> Wed, 09 Jan 2013 01:24:35 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/531952/ https://lwn.net/Articles/531952/ rvolgers <div class="FormattedComment"> Looking at the source a user namespace root user has all capabilities within that namespace, and raw socket access is controlled by a ns_capable(...) check, so it should be possible.<br> <p> I have not tested this, so take it with a grain of salt. <br> </div> Wed, 09 Jan 2013 00:23:46 +0000 Namespaces in operation, part 2: the namespaces API https://lwn.net/Articles/531928/ https://lwn.net/Articles/531928/ justincormack <div class="FormattedComment"> I have spent a fair amount of time with these interfaces, except the shiny new user namespace, so I am a bit confused by that. If you change to a new user ns and therefore become "root" what can you do? Is it affected by which other namespaces you are in? eg if you create a new user ns and new netns can you say use ping or other root-requiring network ops? I guess I should install a new kernel and experiment...<br> <p> </div> Tue, 08 Jan 2013 22:04:17 +0000