.BR unshare (1)
to create a process running a new shell in new cgroup and mount namespaces:
.PP
-.EX
.in +4n
+.EX
# \fBPS1="sh2# " unshare \-Cm bash\fP
-.in
.EE
+.in
.PP
From the new shell started by
.BR unshare (1),
with PID 1), and the process in the sibling cgroup
.RI ( sub2 ):
.PP
-.EX
.in +4n
+.EX
sh2# \fBcat /proc/self/cgroup | grep freezer\fP
7:freezer:/
sh2# \fBcat /proc/1/cgroup | grep freezer\fP
7:freezer:/..
sh2# \fBcat /proc/20124/cgroup | grep freezer\fP
7:freezer:/../sub2
-.in
.EE
+.in
.PP
From the output of the first command,
we see that the freezer cgroup membership of the new shell
.IR /proc/self/mountinfo
we see the following anomaly:
.PP
-.EX
.in +4n
+.EX
sh2# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 /.. /sys/fs/cgroup/freezer ...
-.in
.EE
+.in
.PP
The fourth field of this line
.RI ( /.. )
from the new shell (i.e., perform the mount from a process that is in the
new cgroup namespace), after which we see the expected results:
.PP
-.EX
.in +4n
+.EX
sh2# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events
# to other namespaces
sh2# \fBumount /sys/fs/cgroup/freezer\fP
sh2# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP
sh2# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ...
-.in
.EE
+.in
.\"
.SH CONFORMING TO
Namespaces are a Linux-specific feature.