public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: serue@us.ibm.com, linuxram@us.ibm.com,
	linux-fsdevel@vger.kernel.org, viro@ftp.linux.org.uk,
	containers@lists.osdl.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag
Date: Tue, 17 Apr 2007 13:54:14 -0600	[thread overview]
Message-ID: <m1vefuixp5.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <E1HdsX6-0002Kl-00@dorka.pomaz.szeredi.hu> (Miklos Szeredi's message of "Tue, 17 Apr 2007 20:36:04 +0200")

Miklos Szeredi <miklos@szeredi.hu> writes:

>> > I'm still not sure, what your problem is.
>> 
>> My problem right now is that I see a serious complexity escalation in
>> the user interface that we must support indefinitely.
>> 
>> I see us taking a nice powerful concept and seriously watering it down.
>> To some extent we have to avoid confusing suid applications.  (I would
>> so love to remove the SUID bit...).
>> 
>> I'm being contrary to ensure we have a good code review.
>
> OK.  And it's very much appreciated :)
>
>> I have heard it said that there are two kinds of design.  Something
>> so simple it obviously has no deficiencies.  Something so complex it has
>> no obvious deficiencies.  I am very much afraid we are slipping the
>> mount namespace into the latter category of work.  Which is a bad
>> bad thing for core OS feature.
>
> I've tried to make this unprivileged mount thing as simple as
> possible, and no simpler.  If we can make it even simpler, all the
> better.

We are certainly much more complex then the code in plan9 (just
read through it) so I think we have room for improvement.

Just for reference what I saw in plan 9 was:
- No super user checks in it's mount, unmount, or namespace creation paths.
- A flag to deny new mounts but not new bind mounts (for administrative purposes
  the comment said).

Our differences from plan9.
- suid capable binaries. (SUID please go away).
- A history of programs assuming only root could call mount/unmount.

>> In part this really disturbs me because we now have two mechanisms for
>> controlling the scope of what a user can do.
>
> You mean rbind+chroot and clone(CLONE_NS)?  Yes, those are two
> different mechanisms achieving very similar results.  But what has
> this to do with unprivileged mounts?

The practical question is how do we limit what a user can mount and
unmount.


I would contend that at first glance stuffing a user in their own
mount namespace is sufficient, on a system with utilities aware
of the consequences of mount/unmount.

So we may not need a unprivileged mount disable except as a way
to allow an old user space to run a new kernel.

>> A flag or a new namespace.  Two mechanisms to accomplish the same
>> thing sound wrong, and hard to manage.
>
> The flag permitting the unprivileged mounts (which we now agreed to
> name "allowusermnt") is used in both cases.
>
> Just creating a new namespace doesn't always imply that you want to
> allow user mounts inside, does it?  These are orthogonal features.

After user space has been updated we always want to allow unprivileged
mounts. 

If I get pushed I will say that we need to remove suid exec capability
from user space as well.  At which point we don't even need directory
security checks, there is enough benefit there I certainly think
it is worth considering having an entire NOSUID user space.

Removing suid is probably excessive but if it isn't much harder
then sane mount namespace support we should probably consider it.


>> >   - sysadmin creates /mnt/usermounts writable to all users, with
>> >     sticky bit (same as /tmp), does "mount --bind /mnt/usermounts
>> >     /mnt/usermounts" and sets the "allow unpriv submounts" on
>> >     /mnt/usermounts.
>> >
>> > All of these are perfectly safe wrt userdel and backup (assuming it
>> > doesn't try back up /mnt).
>> 
>> I also don't understand at all the user= mount flag and options.
>
> The "user=UID" or (or MNT_USER flag) serves multiple purposes:
>
>   - help mount(8) move away from /etc/mtab
>   - allow unprivileged umounts
>   - account user mounts
>
>> All it seemed to be used for was adding permissions to unmount.  In user
>> space to deal with the lack of any form of untrusted mounts I can understand
>> this.  In kernel space this seems to be more of a problem.
>
> Why is handling unprivileged mounts in kernel different from handling
> them in userspace in this respect?

Ok.  I just looked at what user space is doing.  The difference is that
what user space is doing predates mount namespaces, and was there as
far as I can tell to keep one user from causing problems for
another user.   If we choose to make mount namespaces to be
the unit of granularity we don't need this capability.

All we have to do is deny unmounts that would confuse a suid
executable.  Which mounts are those?

Eric

  reply	other threads:[~2007-04-17 19:56 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 16:45 [patch 00/10] (resend) mount ownership and unprivileged mount syscall Miklos Szeredi
2007-04-12 16:45 ` [patch 01/10] add user mounts to the kernel Miklos Szeredi
2007-04-12 16:45 ` [patch 02/10] allow unprivileged umount Miklos Szeredi
2007-04-12 16:45 ` [patch 03/10] account user mounts Miklos Szeredi
2007-04-12 16:45 ` [patch 04/10] add "permit user mounts" flag to namespaces Miklos Szeredi
2007-04-12 16:45 ` [patch 05/10] add "permit user mounts in new namespace" clone flag Miklos Szeredi
2007-04-12 20:32   ` Serge E. Hallyn
2007-04-13  4:16     ` Herbert Poetzl
2007-04-13  7:09       ` Miklos Szeredi
2007-04-13  4:45     ` Eric W. Biederman
2007-04-13  7:12       ` Miklos Szeredi
2007-04-13 13:47         ` Serge E. Hallyn
2007-04-13 14:22           ` Eric W. Biederman
2007-04-16  8:47       ` [Devel] " Ram Pai
2007-04-16  9:32         ` Miklos Szeredi
2007-04-16  9:49           ` Ram Pai
2007-04-16  9:56             ` Miklos Szeredi
2007-04-16 15:43               ` Eric W. Biederman
2007-04-16 15:58                 ` Miklos Szeredi
2007-04-16 19:16                   ` Eric W. Biederman
2007-04-16 19:56                     ` Serge E. Hallyn
2007-04-17  9:04                       ` Eric W. Biederman
2007-04-17 11:09                         ` Miklos Szeredi
2007-04-17 18:16                           ` Eric W. Biederman
2007-04-17 18:36                             ` Miklos Szeredi
2007-04-17 19:54                               ` Eric W. Biederman [this message]
2007-04-18  9:11                                 ` Miklos Szeredi
2007-04-18 13:55                                   ` Trond Myklebust
2007-04-18 14:03                                     ` Miklos Szeredi
2007-04-18 14:26                                       ` Trond Myklebust
2007-04-18 15:01                                         ` Christoph Hellwig
2007-04-18 19:00                                           ` Trond Myklebust
2007-04-18 15:06                                         ` Miklos Szeredi
2007-04-18 17:14                                   ` Eric W. Biederman
2007-04-18 18:05                                     ` Miklos Szeredi
2007-04-19  9:02                                       ` Miklos Szeredi
2007-04-17 14:25                         ` Serge E. Hallyn
2007-04-17 14:28                         ` Serge E. Hallyn
2007-04-16 17:14               ` Ram Pai
2007-04-16 17:50                 ` Miklos Szeredi
2007-04-17 17:07                   ` Serge E. Hallyn
2007-04-17 17:44                     ` Miklos Szeredi
2007-04-17 18:15                       ` Serge E. Hallyn
2007-04-17 18:58                         ` Miklos Szeredi
2007-04-17 19:28                       ` Ram Pai
2007-04-17 19:43                         ` Miklos Szeredi
2007-04-17 20:25                           ` Ram Pai
2007-04-18  9:19                             ` Miklos Szeredi
2007-04-18 18:35                               ` Ram Pai
2007-04-18 19:14                                 ` Miklos Szeredi
2007-04-18 19:41                                   ` Ram Pai
2007-04-19  8:36                                     ` Miklos Szeredi
2007-04-12 16:45 ` [patch 06/10] propagate error values from clone_mnt Miklos Szeredi
2007-04-12 16:45 ` [patch 07/10] allow unprivileged bind mounts Miklos Szeredi
2007-04-12 16:45 ` [patch 08/10] put declaration of put_filesystem() in fs.h Miklos Szeredi
2007-04-12 16:45 ` [patch 09/10] allow unprivileged mounts Miklos Szeredi
2007-04-12 16:45 ` [patch 10/10] allow unprivileged fuse mounts Miklos Szeredi

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=m1vefuixp5.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=miklos@szeredi.hu \
    --cc=serue@us.ibm.com \
    --cc=viro@ftp.linux.org.uk \
    /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