[PATCH] devpts: Add ptmx_uid and ptmx_gid options
Andy Lutomirski <luto@...
2015-02-21 01:04:22 GMT
It's currently impossible to mount devpts in a user namespace that
has no root user, since ptmx can't be created. This adds options
ptmx_uid and ptmx_gid that override the default uid and gid of 0.
These options are not shown in mountinfo because they have no effect
other than changing the initial mode of ptmx, and, in particular, it
wouldn't make any sense to change them on remount. Instead, we
disallow them on remount.
This could be changed, but we'd probably want to fix the userns
behavior of uid and gid at the same time if we did so.
Signed-off-by: Andy Lutomirski <luto@...>
Documentation/filesystems/devpts.txt | 4 +++
fs/devpts/inode.c | 58 ++++++++++++++++++++++++++----------
2 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/Documentation/filesystems/devpts.txt b/Documentation/filesystems/devpts.txt
index 68dffd87f9b7..7808e77d0d72 100644
<at> <at> -121,6 +121,10 <at> <at> once), following user-space issues should be noted.
chmod 666 /dev/pts/ptmx
+ The ownership for /dev/pts/ptmx can be specified using the ptmxuid
+ and ptmxgid options. Both default to zero, which, in user namespaces
+ that have no root user, will cause mounting to fail.