3 ms·
> These were just examples, Linux is trying to catch up in ugly ways indeed ... In the Hurd, it's that way from the ground and there is no limitation like havin
by derefr 12y ago
> These were just examples, Linux is trying to catch up in ugly ways indeed ... In the Hurd, it's that way from the ground and there is no limitation like having to be root or ask for root to add magic lines, etc.
HURD might have user filesystem servers, but they're nowhere near Plan9's "each process gets a mount table, and then things like environment variables are just exposed process-local mounted filesystems."
Interestingly, given all the cgroups work put into the Linux kernel, you can almost achieve this postmodern "every process gets its own VFS, and uses it as scratch-space" effect with the one-two punch of:
fusermount ... /mnt/env/1
docker run -v "/mnt/env/1:/env" ubuntu
This, admittedly, still takes root-esque privileges somewhere along the line (either fusermount is SUID and run on the host, or the container must be run -privileged so you can mount inside it), but this isn't a fundamental restriction, just a historical artifact of Docker being designed before user-namespaces were finished. It's perfectly possible with raw unshare(2) to spawn a process as an unprivileged user, in which the process is acting with alternate-namespace UID0 privileges, and can mount whatever filesystems it likes in its alternate-namespace VFS.
- justincormack 12y agoThe Linux containers people were directly influenced by Plan 9 in the design.
- stormbrew 12y agoThe need for privilege escalation to create the namespace is basically the rub for this sort of thing. It seems like the main thing that makes true plan9-style namespacing unrealistic is the security implications, since the filesystem is used extensively to control privilege escalation. Whether it's through setuid flags or through /etc/sudoers or /etc/groups, at some point a privileged program (su or sudo) might be running in an unknown or untrusted namespace where the facts visible to that program make a solid case for allowing the escalation. I'm not sure this tension can ever really be resolved without also adopting a plan9-style out-of-process escalation mechanism. Which is a huge departure from POSIX in and of itself, as far as I know. I'm really not sure how HURD deals with this, to be honest, or if it does at all.
- smorrow 12y agoActually there's just one /env in Plan 9, that behaves differently depending on what pid is reading it. So it's like /dev/tty in Unix.