All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: James Bottomley
	<James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
Cc: Linux Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: bind mounting namespace inodes for unprivileged users
Date: Wed, 04 May 2016 09:38:03 -0500	[thread overview]
Message-ID: <87oa8lc2ic.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <1462299656.16133.51.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> (James Bottomley's message of "Tue, 03 May 2016 14:20:56 -0400")

James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> writes:

> Right at the moment, unprivileged users cannot call mount --bind to
> create a permanent copy of any of their namespaces.  This is annoying
> because it means that for entry to long running containers you have to
> spawn an undying process and use nsenter via the /proc/<pid>/ns files.
>
> The first question is:  assuming we restrict it to bind mounting only
> nsfs inodes, is there any reason an unprivileged user shouldn't be able
> to bind a namespace they've created to a file they own in the initial
> mount namespace?

Own, have read/write and unlink privileges.

My big concern would be the fact that a bind mount today makes a file
immune from unlink.  So it would mess up rm -rf.

That might not be worse than what a setuid fuse mount binary allows
today.

I wonder if there might is a way to setup a
user namespace and mount namespace combination so users could manage
mounts in their own login shells, just like is allowed in plan 9.
Long term I think that would be more satisfactory.


> So, does anyone have any strong (or even weak) opinions about this
> before I start coding patches?

The mount namespace is complex and getting it right is a pain in the
rear.  So adding yet another path and piece in to the existing
complexity makes me cringe a little.

Eric

WARNING: multiple messages have this Message-ID (diff)
From: ebiederm@xmission.com (Eric W. Biederman)
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Linux Containers <containers@lists.linux-foundation.org>,
	util-linux@vger.kernel.org
Subject: Re: bind mounting namespace inodes for unprivileged users
Date: Wed, 04 May 2016 09:38:03 -0500	[thread overview]
Message-ID: <87oa8lc2ic.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <1462299656.16133.51.camel@HansenPartnership.com> (James Bottomley's message of "Tue, 03 May 2016 14:20:56 -0400")

James Bottomley <James.Bottomley@HansenPartnership.com> writes:

> Right at the moment, unprivileged users cannot call mount --bind to
> create a permanent copy of any of their namespaces.  This is annoying
> because it means that for entry to long running containers you have to
> spawn an undying process and use nsenter via the /proc/<pid>/ns files.
>
> The first question is:  assuming we restrict it to bind mounting only
> nsfs inodes, is there any reason an unprivileged user shouldn't be able
> to bind a namespace they've created to a file they own in the initial
> mount namespace?

Own, have read/write and unlink privileges.

My big concern would be the fact that a bind mount today makes a file
immune from unlink.  So it would mess up rm -rf.

That might not be worse than what a setuid fuse mount binary allows
today.

I wonder if there might is a way to setup a
user namespace and mount namespace combination so users could manage
mounts in their own login shells, just like is allowed in plan 9.
Long term I think that would be more satisfactory.


> So, does anyone have any strong (or even weak) opinions about this
> before I start coding patches?

The mount namespace is complex and getting it right is a pain in the
rear.  So adding yet another path and piece in to the existing
complexity makes me cringe a little.

Eric

  parent reply	other threads:[~2016-05-04 14:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 18:20 bind mounting namespace inodes for unprivileged users James Bottomley
2016-05-03 21:22 ` Serge Hallyn
2016-05-04 11:15   ` James Bottomley
2016-05-04 11:15   ` James Bottomley
     [not found] ` <1462299656.16133.51.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-03 21:22   ` Serge Hallyn
2016-05-04  8:44   ` Karel Zak
2016-05-04  8:44     ` Karel Zak
     [not found]     ` <20160504084403.7z67paycj663lkbt-xkT7n84Rsxv/9pzu0YdTqQ@public.gmane.org>
2016-05-04 13:16       ` James Bottomley
2016-05-04 13:16         ` James Bottomley
2016-05-04 14:38   ` Eric W. Biederman [this message]
2016-05-04 14:38     ` Eric W. Biederman
     [not found]     ` <87oa8lc2ic.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-04 17:28       ` James Bottomley
2016-05-04 17:28         ` James Bottomley
     [not found]         ` <1462382890.14310.67.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-04 17:43           ` Eric W. Biederman
2016-05-04 17:43         ` Eric W. Biederman
2016-05-04 18:00           ` James Bottomley
     [not found]           ` <87futx3eid.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-04 18:00             ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2016-05-03 18:20 James Bottomley

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=87oa8lc2ic.fsf@x220.int.ebiederm.org \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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.