fix depvpts in user namespaces
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 47 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | dev_cgroup: keep track of which cgroup is the root cgroupinclude/ security/ | +14 | 7 replies | |
| 2/4 | fs: allow dev accesses in userns in controlled situationsfs/ fs/ include/ | +7 | 9 replies | |
| 3/4 | fs: allow mknod in user namespacesfs/ | +1 | 12 replies | |
| 3/4 | fs: allow mknod in user namespacesfs/ | +1 | 0 replies | |
| 4/4 | devpts: fix usage in user namespacesfs/ | +151 | 2 replies | |
| 4/4 | devpts: fix usage in user namespacesfs/ | +151 | 0 replies |
Reviews trailers per patch
4 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Serge E. Hallyn | Aristeu Rozanski |
|---|---|---|
| 1/4 | A-b A-b | A-b |
| 2/4 | A-b A-b | |
| 3/4 | A-b A-b | |
| 3/4 | A-b A-b | |
| 4/4 | ||
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/4] fix depvpts in user namespaces
Hi,
devpts mounts in user namespaces is queued for 3.9. However, while playing with it I found it to be less than ideal. Although it could possibly work with custom software that can be made to point to /dev/pts/ptmx, a few things prevent it from working correctly for people that, like us, are booting full distributions.
In those scenarios, things like udev will kick in, maybe remount /dev undoing any setup we might have done, and then software like sshd or anything else calling openpty will search for /dev/ptmx, not /dev/pts/ptmx.
One of the problems that I am addressing in here is that we are disallowing mknod in usernamespaces. Although I understand the motivation for that, I believe that to be too restrictive, specially because we already control access to the files separately. There should be no harm in mknod'ing something per se, if manipulating it is forbidden.
That too, however, is too restrictive. Following the precedence that we set by letting memcg manage the memory for tmpfs mounts, I am doing the same here with the device cgroup. With the exception that instead of suggesting, here we have a way to actually enforce it. Unless the mount was specifically marked as nodev, reads and writes will be allowed to proceed if a device cgroup is containing the process. The device cgroup will then be the one responsible for setting fine grained access about which devices can and cannot be manipulated.
Last, /dev/ptmx will still always be the global ptmx device. We need to somehow link it to our namespaces'. My proposal is to multiplex it and return the correct "root ptmx" depending on which userns is reading that device.
Glauber Costa (4):
dev_cgroup: keep track of which cgroup is the root cgroup
fs: allow dev accesses in userns in controlled situations
fs: allow mknod in user namespaces
devpts: fix usage in user namespaces
fs/devpts/inode.c | 157 +++++++++++++++++++++++++++++++++++++++++++++-- fs/namei.c | 6 +- fs/namespace.c | 2 +- include/linux/mount.h | 2 + include/linux/security.h | 1 + security/device_cgroup.c | 15 ++++- 6 files changed, 173 insertions(+), 10 deletions(-)
Signature · 1 line
1.8.1.2