/etc/mtab and per-process namespaces
On Oct 13, 7:10pm, Mike Waychison wrote:
} Subject: Re: /etc/mtab and per-process namespaces
Good morning to everyone, really behind on e-mail, my apologies for joining the thread late.
Quoted 21 lines
Quoted 11 lines · Ram
Quoted 9 lines · David Leimbach
Hmm no responses on this thread a couple days now. I guess:
1) No one cares about private namespaces or the fact that they make
/etc/mtabtotally inconsistent.
2) Private Namespaces aren't important to anyone and will never be robust unless someone who cares, like me, takes it over somehow.
3) Everyone is busy with their own shit and doesn't want to deal with me or mine right now.Quoted 5 lines
Quoted 5 lines
I'm seriously hoping it's 3 :). 2 Is acceptable too of course. I think this is important and I want to know more about the innards anyway. 1 would make me sad as I think Linux can really show other Unix's what-for here when it comes to showing off how good the VFS can be.
Or, you bite the bullet and fix
/proc/mountsand let distributions bind mount/proc/mountsover/etc/mtab.
Quoted 7 lines
Sun recognized this as a problem a long time ago and
/etc/mnttabhas been magic for quite some time now.Add to this the fact that a textfile
/etc/mtabis busted because it's whitespace seperated and pieces blows up and you do things like:mount filer:/export/mikew "
/home/MikeWaychison"
As to the three options above, I believe number 3 would be operative. Private namespaces are extremely useful concepts, we are growing increasingly dependent on them for systems management and administration. I believe the issue is a chicken/egg problem, without an update in tools the concept of namespaces are less approachable than they should be.
Mike's comments are very apt. The current situation with mount support is untenable. Even working on private development machines it gets confusing as to what is or is not mounted in various shells/processes. The basic infra-structure is there with process specific mount information (/proc/self/mounts) but mount and friends are a bit problematic with respect to supporting this.
I'm working on a namespace toolkit to address these issues. I've got a pretty basic tool, similar to sudo, which allows spawning processes with a protected namespace. I'm adding a configuration system which allow systems administrators to define a setup of bind mounts which are automatically executed before the user is given their shell. I'm also working up a PAM account module to go along with this. I would certainly be open to suggestions as to what else people would consider useful in such a toolkit.
I've been pondering the best way to take on the mount problem. Current mount binaries seem to fall back to /proc/mounts if /etc/mtab is not present. All bets are off of course if the mount binary is used for the bind mount since a new /etc/mtab is created.
I'm willing to whack on the mount binary a bit as part of this. The obvious solution is to teach mount to act differently if it is running in a private namespace. If anybody knows of a good way to detect this I would be interested in knowing that. In newns (the namespace sudo tool) I'm setting an environment variable for mount to detect on but a system level approach would be more generic.
The other problem is the information exported in /proc/mounts. It would seem problematic to modify its format but in order to serve as a useful source of information for a modified mount binary it would need to contain mount option information. Since this is definitely process specific information it would seem to call for something in /proc rather than /sysfs. Do we need a new pseudo-file?
I would be certainly interested in peoples reflections on this. When I get something a bit more shaken down I will roll up a preliminary distribution and announce it.
Quoted 1 line
Mike Waychison
Best wishes for a pleasant weekend to everyone.
Greg
}-- End of excerpt from Mike Waychison
As always,
Dr. Greg 'GW' Wettstein
------------------------------------------------------------------------------
The Hurderos Project
Open Identity, Service and Authorization Management
http://www.hurderos.org
Quoted 63 lines · Dr. Greg Wettstein
On Oct 13, 7:10pm, Mike Waychison wrote:
} Subject: Re:/etc/mtaband per-process namespacesGood morning to everyone, really behind on e-mail, my apologies for joining the thread late.
Quoted 21 lines
Quoted 11 lines · Ram
Quoted 9 lines · David Leimbach
Hmm no responses on this thread a couple days now. I guess:
1) No one cares about private namespaces or the fact that they make
/etc/mtabtotally inconsistent.
2) Private Namespaces aren't important to anyone and will never be robust unless someone who cares, like me, takes it over somehow.
3) Everyone is busy with their own shit and doesn't want to deal with me or mine right now.Quoted 5 lines
Quoted 5 lines
I'm seriously hoping it's 3 :). 2 Is acceptable too of course. I think this is important and I want to know more about the innards anyway. 1 would make me sad as I think Linux can really show other Unix's what-for here when it comes to showing off how good the VFS can be.
Or, you bite the bullet and fix
/proc/mountsand let distributions bind mount/proc/mountsover/etc/mtab.Quoted 7 lines
Sun recognized this as a problem a long time ago and
/etc/mnttabhas been magic for quite some time now.Add to this the fact that a textfile
/etc/mtabis busted because it's whitespace seperated and pieces blows up and you do things like:mount filer:/export/mikew "
/home/MikeWaychison"As to the three options above, I believe number 3 would be operative. Private namespaces are extremely useful concepts, we are growing increasingly dependent on them for systems management and administration. I believe the issue is a chicken/egg problem, without an update in tools the concept of namespaces are less approachable than they should be.
Mike's comments are very apt. The current situation with mount support is untenable. Even working on private development machines it gets confusing as to what is or is not mounted in various shells/processes. The basic infra-structure is there with process specific mount information (
/proc/self/mounts) but mount and friends are a bit problematic with respect to supporting this.I'm working on a namespace toolkit to address these issues. I've got a pretty basic tool, similar to sudo, which allows spawning processes with a protected namespace. I'm adding a configuration system which allow systems administrators to define a setup of bind mounts which are automatically executed before the user is given their shell. I'm also working up a PAM account module to go along with this. I would certainly be open to suggestions as to what else people would consider useful in such a toolkit.
I've been pondering the best way to take on the mount problem. Current mount binaries seem to fall back to
/proc/mountsif/etc/mtabis not present. All bets are off of course if the mount binary is used for the bind mount since a new/etc/mtabis created.
Quoted 6 lines
I'm willing to whack on the mount binary a bit as part of this. The obvious solution is to teach mount to act differently if it is running in a private namespace. If anybody knows of a good way to detect this I would be interested in knowing that. In newns (the namespace sudo tool) I'm setting an environment variable for mount to detect on but a system level approach would be more generic.
actually there is a hackish way for a process to figure out if it is in a different namespace than the system namespace.
ls /proc/1/root
in a system namespace it will allow you to see the content. And in a per-process-namespace it will fail with permission denied.
But I think we should figure out a cleaner way to decipher this, and that would start with clearly defining the requirements, I think.
RP
Quoted 6 lines · Ram Pai
Quoted 6 lines
Mike's comments are very apt. The current situation with mount support is untenable. Even working on private development machines it gets confusing as to what is or is not mounted in various shells/processes. The basic infra-structure is there with process specific mount information (
/proc/self/mounts) but mount and friends are a bit problematic with respect to supporting this.
I fairly extensively rewrote busybox mount, and one of my goals was doing the best job with /proc/mounts (only) support that I could. In some ways, busybox's mount is better (such as the fact it can autodetect when you're trying to mount a file and figure out it needs -o loop without being told).
If you want try the busybox version of mount/losetup/umount, I hope it does what you want and am willing to fix it if it doesn't. (P.S. To use /proc/mounts either configure it without /etc/mtab support or symlink /etc/mtab to /proc/mounts.)
Quoted 9 lines
Quoted 9 lines
I'm working on a namespace toolkit to address these issues. I've got a pretty basic tool, similar to sudo, which allows spawning processes with a protected namespace. I'm adding a configuration system which allow systems administrators to define a setup of bind mounts which are automatically executed before the user is given their shell. I'm also working up a PAM account module to go along with this. I would certainly be open to suggestions as to what else people would consider useful in such a toolkit.
Quoted 4 lines
Quoted 4 lines
I've been pondering the best way to take on the mount problem. Current mount binaries seem to fall back to
/proc/mountsif/etc/mtabis not present. All bets are off of course if the mount binary is used for the bind mount since a new/etc/mtabis created.
Have you tried having /etc/mtab be a symlink to /proc/mounts?
Quoted 10 lines
Quoted 6 lines
I'm willing to whack on the mount binary a bit as part of this. The obvious solution is to teach mount to act differently if it is running in a private namespace. If anybody knows of a good way to detect this I would be interested in knowing that. In newns (the namespace sudo tool) I'm setting an environment variable for mount to detect on but a system level approach would be more generic.
actually there is a hackish way for a process to figure out if it is in a different namespace than the system namespace.
Quoted 7 lines
ls
/proc/1/rootin a system namespace it will allow you to see the content. And in a per-process-namespace it will fail with permission denied.
But I think we should figure out a cleaner way to decipher this, and that would start with clearly defining the requirements, I think.
The big thing I've never figured out how to do is make umount -a work in the presence of multiple namespaces. (Should it just umount what it sees? I don't know how to umount everything because I can't find everything...)
Quoted 1 line
RP
Rob
Quoted 50 lines · Rob Landley
Quoted 6 lines · Ram Pai
Quoted 6 lines
Mike's comments are very apt. The current situation with mount support is untenable. Even working on private development machines it gets confusing as to what is or is not mounted in various shells/processes. The basic infra-structure is there with process specific mount information (
/proc/self/mounts) but mount and friends are a bit problematic with respect to supporting this.I fairly extensively rewrote busybox mount, and one of my goals was doing the best job with
/proc/mounts(only) support that I could. In some ways, busybox's mount is better (such as the fact it can autodetect when you're trying to mount a file and figure out it needs -o loop without being told).If you want try the busybox version of mount/losetup/umount, I hope it does what you want and am willing to fix it if it doesn't. (
P.S. To use/proc/mountseither configure it without/etc/mtabsupport or symlink/etc/mtabto/proc/mounts.)Quoted 9 lines
Quoted 9 lines
I'm working on a namespace toolkit to address these issues. I've got a pretty basic tool, similar to sudo, which allows spawning processes with a protected namespace. I'm adding a configuration system which allow systems administrators to define a setup of bind mounts which are automatically executed before the user is given their shell. I'm also working up a PAM account module to go along with this. I would certainly be open to suggestions as to what else people would consider useful in such a toolkit.
Quoted 4 lines
Quoted 4 lines
I've been pondering the best way to take on the mount problem. Current mount binaries seem to fall back to
/proc/mountsif/etc/mtabis not present. All bets are off of course if the mount binary is used for the bind mount since a new/etc/mtabis created.Have you tried having
/etc/mtabbe a symlink to/proc/mounts?Quoted 15 lines
Quoted 6 lines
I'm willing to whack on the mount binary a bit as part of this. The obvious solution is to teach mount to act differently if it is running in a private namespace. If anybody knows of a good way to detect this I would be interested in knowing that. In newns (the namespace sudo tool) I'm setting an environment variable for mount to detect on but a system level approach would be more generic.
actually there is a hackish way for a process to figure out if it is in a different namespace than the system namespace.
ls
/proc/1/rootin a system namespace it will allow you to see the content. And in a per-process-namespace it will fail with permission denied.
Quoted 6 lines
Quoted 2 lines
But I think we should figure out a cleaner way to decipher this, and that would start with clearly defining the requirements, I think.
The big thing I've never figured out how to do is make umount -a work in the presence of multiple namespaces. (Should it just umount what it sees? I don't know how to umount everything because I can't find everything...)
Yes you won't find everything, since some of them are in a different namespaces. Instead unmount whatever you see. Or use /proc/mounts to unmount whatever is there in its namespace.
RP
Quoted 8 lines · Ram Pai
Quoted 4 lines
The big thing I've never figured out how to do is make umount -a work in the presence of multiple namespaces. (Should it just umount what it sees? I don't know how to umount everything because I can't find everything...)
Yes you won't find everything, since some of them are in a different namespaces. Instead unmount whatever you see. Or use
/proc/mountsto unmount whatever is there in its namespace.
But /proc/mounts is a symlink to self/mounts, and self is a symlink to $PID, so after burrowing through the symlinks you wind up looking
at /proc/$PID/mounts.
My concern is that if I have init, as root, try to perform a umount -a, it _still_ won't get the mounts belonging to child processes with a separate namespace. There's no "global view" of mounts available anywhere.
On the other hand, if we fork a child process with its own namespace, the child performs a private mount, and then we kill that child process, does that hidden mount get umounted cleanly via refcounting? (Or does it leak?)
If killing the processes umounts their private mounts, all init has to do is make sure all child processes are dead before doing a umount -a on what's left. (Then, of course, there's FUSE. Does killing the FUSE helper prevent the mount from being umounted?)
It's a bit conceptually persnickety, so far...
Rob
Quoted 10 lines · Rob Landley
Quoted 8 lines · Ram Pai
Quoted 4 lines
The big thing I've never figured out how to do is make umount -a work in the presence of multiple namespaces. (Should it just umount what it sees? I don't know how to umount everything because I can't find everything...)
Yes you won't find everything, since some of them are in a different namespaces. Instead unmount whatever you see. Or use
/proc/mountsto unmount whatever is there in its namespace.
Quoted 7 lines
But
/proc/mountsis a symlink to self/mounts, and self is a symlink to $PID, so after burrowing through the symlinks you wind up looking
at/proc/$PID/mounts.My concern is that if I have init, as root, try to perform a umount -a, it _still_ won't get the mounts belonging to child processes with a separate namespace. There's no "global view" of mounts available anywhere.
and having a "global view" is a debatable issue. What you are asking for is a way for a process to be able to access all the mounts irrespective of which namespace it belongs to.
I think 'umount -a' semantics has to be refined and made as 'unmount all the mounts belonging its namespace'. And if you agree with the semantics, than unmouting whatever is found in /proc/mounts would suffice.
Quoted 4 lines
On the other hand, if we fork a child process with its own namespace, the child performs a private mount, and then we kill that child process, does that hidden mount get umounted cleanly via refcounting? (Or does it leak?)
yes all the mounts in the namespace will get cleaned up if no processes have access to that namespace.
Quoted 5 lines
If killing the processes umounts their private mounts, all init has to do is make sure all child processes are dead before doing a umount -a on what's left. (Then, of course, there's FUSE. Does killing the FUSE helper prevent the mount from being umounted?)
Again as I said above, 'umount -a' has just to restrict itself to its own namespace.
RP
Quoted 4 lines
It's a bit conceptually persnickety, so far...
Rob
Quoted 2 lines
(Then, of course, there's FUSE. Does killing the FUSE helper prevent the mount from being umounted?)
No. On clean exit (via INT, TERM, HUP handlers installed by library) it will lazy umount itself. Violent death of a filesystem daemon will leave the mount intact, but umountable.
Miklos
Quoted 6 lines · Miklos Szeredi
Quoted 2 lines
(Then, of course, there's FUSE. Does killing the FUSE helper prevent the mount from being umounted?)
No. On clean exit (via INT, TERM, HUP handlers installed by library) it will lazy umount itself. Violent death of a filesystem daemon will leave the mount intact, but umountable.
Ok, so it sounds like the proper init-go-byebye procedure once namespaces get deployed is for init to kill all child processes, umount -a what's left in its namespace, and all is well. So no changes are needed to the umount -a implementation...
Rob