linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Hallyn <serge.hallyn@ubuntu.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Linux Containers <containers@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	stable <stable@vger.kernel.org>,
	Kenton Varda <kenton@sandstorm.io>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] fs: Remove implicit nodev for new mounts in non-root userns
Date: Fri, 15 Aug 2014 20:16:29 +0000	[thread overview]
Message-ID: <20140815201629.GF11476@ubuntumail> (raw)
In-Reply-To: <CALCETrWB0qBiyfJbapFnjxoNyNvS+aHvgc_eob3fC1j=cv+v5w@mail.gmail.com>

Quoting Andy Lutomirski (luto@amacapital.net):
> On Fri, Aug 15, 2014 at 12:37 PM, Serge Hallyn <serge.hallyn@ubuntu.com> wrote:
> > Quoting Andy Lutomirski (luto@amacapital.net):
> >> On Fri, Aug 15, 2014 at 12:05 PM, Serge Hallyn <serge.hallyn@ubuntu.com> wrote:
> >> > Quoting Andy Lutomirski (luto@amacapital.net):
> >> >> Currently, creating a new mount (as opposed to bindmount) in a
> >> >> non-root userns will implicitly set nodev unless the fs is devpts.
> >> >> Something like this will be necessary for file systems that allow
> >> >> the mounter to create device nodes without using mknod (e.g. FUSE
> >> >> if/when that is allowed), but none of the currently allowed
> >> >> filesystems do this.
> >> >
> >> > Hi,
> >> >
> >> > Sorry, I'm probably thinking stupidly, but I don't see this restriction
> >> > being the case
> >> >
> >> > serge@sl:~$ mount | grep tmp
> >> > [...]
> >> > tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
> >> > serge@sl:~$ sudo mknod /run/kvm c 10 232
> >> > [sudo] password for serge:
> >> > serge@sl:~$ echo $?
> >> > 0
> >> > serge@sl:~$ ls -l /run/kvm
> >> > crw-r--r-- 1 root root 10, 232 Aug 15 14:04 /run/kvm
> >> >
> >> > But you seem to be saying I shouldn't be allowed to create a device inside
> >> > a tmpfs.  What am I overlooking?
> >>
> >> I assume you're in the root userns.  This patch is unnecessary, and
> >> has no effect, if you're in the root userns.
> >
> > Right, but I thought you were justifying adding FS_USERNS_DEV_MOUNT by saying
> > that you cannot mknod in those filesystems.  But I see you actually said
> > "without using mknod".  I guess I don't understand that caveat.
> 
> IIUC, there are two ways that a user could put a device node into
> their filesystem.
> 
> The obvious way is using mknod.  But mknod has its own perfectly valid
> permission checks, and it doesn't need any special handling at mount
> time.
> 
> The less obvious way is to mount a filesystem that already contains a
> device node or to mount a filesystem that gives some other means of
> inserting a device node (e.g. a network filesystem or FUSE).  Those
> might allow inserting device nodes without passing a global capability
> check, so unprivileged users in a userns must not be allowed to mount
> such a filesystem without MNT_NODEV | MNT_LOCK_NODEV.
> 
> Fortunately, none of the existing FS_USERNS_MOUNT filesystems have
> that property.  FUSE will, but we don't support FUSE in a userns yet
> (unfortunately -- it would be a *very* useful feature.)
> 
> I think that, if we ever allow FUSE in a userns, we should return

Which, btw, I'm hoping we'll be allowing soon.

> -EPERM when trying to mount it unless the user specifies MS_NODEV,

In either case we can think that through when the time comes.

> which is what this patch does.  I don't think there's any reason to
> play complicated games to allow programs to get away with omitting
> MS_NODEV.

Thanks, Andy.

  reply	other threads:[~2014-08-15 20:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  0:57 [GIT PULL] namespace updates for v3.17-rc1 Eric W. Biederman
2014-08-06  4:46 ` Stephen Rothwell
2014-08-06  5:16   ` Eric W. Biederman
2014-08-06  6:06     ` Stephen Rothwell
2014-08-06  6:30       ` Eric W. Biederman
2014-08-07 13:28       ` Theodore Ts'o
2014-08-13  2:46 ` Andy Lutomirski
2014-08-13  4:17   ` Eric W. Biederman
2014-08-13  4:38     ` Andy Lutomirski
     [not found]     ` <CAOP=4widH1rMZ1O=hzAT+M_8exdzRPA8pJ+wH29AQ9L0ogu9nw@mail.gmail.com>
2014-08-13 10:24       ` Eric W. Biederman
2014-08-13 17:03         ` Andy Lutomirski
2014-08-14  0:03           ` [PATCH] fs: Remove implicit nodev for new mounts in non-root userns Andy Lutomirski
2014-08-15 19:05             ` Serge Hallyn
2014-08-15 19:16               ` Andy Lutomirski
2014-08-15 19:37                 ` Serge Hallyn
2014-08-15 19:56                   ` Andy Lutomirski
2014-08-15 20:16                     ` Serge Hallyn [this message]
2014-08-15 20:16             ` Serge Hallyn
2014-08-28  1:35             ` Andy Lutomirski
2014-08-15 18:41         ` [GIT PULL] namespace updates for v3.17-rc1 Andy Lutomirski
2014-08-20 15:06 ` Richard Weinberger
2014-08-21  4:53   ` Eric W. Biederman
2014-08-21  6:29     ` Richard Weinberger
2014-08-21  7:24       ` Richard Weinberger
2014-08-21 13:54         ` Eric W. Biederman
2014-08-21 13:12     ` Christoph Hellwig
2014-08-21 13:22       ` Richard Weinberger
2014-08-21 14:09         ` Eric W. Biederman
2014-09-03 21:18           ` Richard Weinberger
2014-11-25 23:15           ` Richard Weinberger
2014-11-29 16:58             ` Richard Weinberger
2014-08-21 13:43       ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140815201629.GF11476@ubuntumail \
    --to=serge.hallyn@ubuntu.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=kenton@sandstorm.io \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).