All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] fix depvpts in user namespaces
@ 2013-03-15  9:13 ` Glauber Costa
  0 siblings, 0 replies; 65+ messages in thread
From: Glauber Costa @ 2013-03-15  9:13 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andrew Morton,
	Eric W. Biederman

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(-)

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 65+ messages in thread

end of thread, other threads:[~2013-03-19 23:29 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15  9:13 [PATCH 0/4] fix depvpts in user namespaces Glauber Costa
2013-03-15  9:13 ` Glauber Costa
     [not found] ` <1363338823-25292-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15  9:13   ` [PATCH 1/4] dev_cgroup: keep track of which cgroup is the root cgroup Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:07       ` Serge Hallyn
2013-03-15 14:43         ` Glauber Costa
2013-03-15 14:43         ` Glauber Costa
2013-03-15 14:43           ` Glauber Costa
     [not found]           ` <514333A2.5060408-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:55             ` Serge Hallyn
2013-03-15 14:55           ` Serge Hallyn
2013-03-15 14:07       ` Serge Hallyn
2013-03-15 19:27       ` Aristeu Rozanski
2013-03-15  9:13   ` [PATCH 2/4] fs: allow dev accesses in userns in controlled situations Glauber Costa
2013-03-15  9:13     ` Glauber Costa
2013-03-15 14:20     ` Serge Hallyn
2013-03-19 15:32       ` Janne Karhunen
     [not found]         ` <CAE=Ncradvs_twWT8b6NQz85dm-Y8ayTH7NFv=i0vjYXpRBW9sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 15:37           ` Serge Hallyn
2013-03-19 16:52             ` Janne Karhunen
     [not found]               ` <CAE=NcrYeKQYqkPsB9FG5PpYd2VTqmTszfpY39aRJqR=vsXfa7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 17:27                 ` Serge Hallyn
2013-03-19 18:08                   ` Janne Karhunen
     [not found]                     ` <CAE=NcraBvk_hwCd9BgASpDBkmEB+fg-kKwAPbT7bQeFRbq5DSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 19:15                       ` Serge Hallyn
2013-03-19 23:29                 ` Eric W. Biederman
     [not found]     ` <1363338823-25292-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:20       ` Serge Hallyn
2013-03-15  9:13   ` [PATCH 3/4] fs: allow mknod in user namespaces Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:37       ` Serge Hallyn
2013-03-15 14:49         ` Glauber Costa
2013-03-15 14:49           ` Glauber Costa
     [not found]           ` <51433511.1020808-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:14             ` Serge Hallyn
2013-03-15 15:14             ` Serge Hallyn
2013-03-15 14:49         ` Glauber Costa
2013-03-15 14:37       ` Serge Hallyn
2013-03-15 18:03       ` Vasily Kulikov
2013-03-15 20:43       ` Eric W. Biederman
2013-03-15 18:03     ` Vasily Kulikov
2013-03-15 20:43     ` Eric W. Biederman
2013-03-15 20:43       ` Eric W. Biederman
2013-03-16  0:23       ` Serge Hallyn
     [not found]       ` <87a9q4gzs1.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-16  0:23         ` Serge Hallyn
2013-03-15  9:13   ` Glauber Costa
2013-03-15  9:13   ` [PATCH 4/4] devpts: fix usage " Glauber Costa
2013-03-15  9:13   ` Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-5-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:45       ` Serge Hallyn
2013-03-15 14:45       ` Serge Hallyn
2013-03-15 10:26   ` [PATCH 0/4] fix depvpts " Eric W. Biederman
     [not found]     ` <87boalt0vi.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-15 12:01       ` Glauber Costa
2013-03-15 14:00       ` Serge Hallyn
2013-03-15 14:00     ` Serge Hallyn
2013-03-15 14:42       ` Glauber Costa
2013-03-15 14:42         ` Glauber Costa
     [not found]         ` <5143333E.1040100-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:21           ` Serge Hallyn
2013-03-15 15:26             ` Glauber Costa
2013-03-15 15:26             ` Glauber Costa
2013-03-15 15:26               ` Glauber Costa
2013-03-15 21:02               ` Eric W. Biederman
2013-03-15 21:02                 ` Eric W. Biederman
2013-03-18  3:20                 ` Serge Hallyn
2013-03-18 21:23                   ` Eric W. Biederman
     [not found]                 ` <87txoce5qy.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-18  3:20                   ` Serge Hallyn
     [not found]               ` <51433DBE.9020109-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:58                 ` Serge Hallyn
2013-03-15 16:01                   ` Glauber Costa
2013-03-15 15:58                 ` Serge Hallyn
2013-03-15 21:02                 ` Eric W. Biederman
2013-03-15 14:42       ` Glauber Costa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.