mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	lkml <linux-kernel@vger.kernel.org>,
	containers@lists.osdl.org
Subject: Re: [PATCH 7/8] user ns: handle file sigio
Date: Wed, 24 Jan 2007 12:58:45 -0600	[thread overview]
Message-ID: <20070124185845.GA597@sergelap.austin.ibm.com> (raw)
In-Reply-To: <m1zm881gq4.fsf@ebiederm.dsl.xmission.com>

Quoting Eric W. Biederman (ebiederm@xmission.com):
> "Serge E. Hallyn" <serue@us.ibm.com> writes:
> 
> > From: Serge E. Hallyn <serue@us.ibm.com>
> > Subject: [PATCH 7/8] user ns: handle file sigio
> >
> > A process in one user namespace could set a fowner and sigio on a file in a
> > shared vfsmount, ending up killing a task in another user namespace.
> >
> > Prevent this by adding a user namespace pointer to the fown_struct, and
> > enforcing that a process causing a signal to be sent be in the same
> > user namespace as the file owner.
> >
> 
> 
> > @@ -455,6 +460,9 @@ static const long band_table[NSIGPOLL] =
> >  static inline int sigio_perm(struct task_struct *p,
> >                               struct fown_struct *fown, int sig)
> >  {
> > +	if (fown->user_ns != init_task.nsproxy->user_ns &&
> > +				fown->user_ns != p->nsproxy->user_ns)
> > +		return 0;
> 
> Why is the initial user namespace being treated specially here?

Because we haven't yet agreed upon any other security model.  For now,
although I know you really dislike it, the fact is that "the initial
namespace has special privileges" is our basic security model.

If you want to have a discussion about an appropriate security model,
or an infrastructure to support multiple models, I think this would be a
good time, given that several namespaces are out there.  And networkns,
making its way up, also has concerns.

Three basic approaches I could see being simple to both implement and
understand/use are

1. add a set of capabilities concerning cross-ns operations, not
reassignable once they are removed.  Simple to understand, very
limited.

2. maintain that any cross-ns operation is allowed if and only if
the target ns is a child of the subject ns.

3. cross-ns operations are not permitted.  The only way to achieve
them is using a (as-yet unimplemented, but i'm working on it) namespace
enter feature to execute code in a child namespace.

> Especially when you start considering nested containers special treatment
> like this is semantically a real problem, to maintain.

Yup.

> If we need to I can see doing something special if the process setting
> fown has CAP_KILL

Obviously CAP_KILL is insufficient :)  I assume you mean a new
CAP_XNS_CAP_KILL?

> and bypassing the security checks that way, but
> hard coding rules like that when it doesn't appear we have any
> experience to indicate we need the extra functionality looks
> premature.

Ok, in this case actually I suspect you're right and we can just ditch
the exception.  But in general the security discussion is one we should
still have.

> >  	return (((fown->euid == 0) ||
> >  		 (fown->euid == p->suid) || (fown->euid == p->uid) ||
> >  		 (fown->uid == p->suid) || (fown->uid == p->uid)) &&
> 
> Eric

  reply	other threads:[~2007-01-24 18:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 22:59 [PATCH 0/8] user namespace: Introduction Serge E. Hallyn
2006-12-19 22:59 ` [PATCH 1/8] nsproxy: externalizes exit_task_namespaces Serge E. Hallyn
2006-12-19 23:00 ` [PATCH 2/8] user ns: add the framework Serge E. Hallyn
2006-12-19 23:00 ` [PATCH 3/8] user ns: add user_namespace ptr to vfsmount Serge E. Hallyn
2006-12-19 23:00 ` [PATCH 4/8] user ns: hook permission Serge E. Hallyn
2007-01-24 17:06   ` Eric W. Biederman
2007-01-24 19:06     ` Serge E. Hallyn
2006-12-19 23:01 ` [PATCH 5/8] user ns: prepare copy_tree, copy_mnt, and their callers to handle errs Serge E. Hallyn
2006-12-19 23:01 ` [PATCH 6/8] user ns: implement shared mounts Serge E. Hallyn
2006-12-19 23:01 ` [PATCH 7/8] user ns: handle file sigio Serge E. Hallyn
2007-01-24 17:23   ` Eric W. Biederman
2007-01-24 18:58     ` Serge E. Hallyn [this message]
2007-01-25  8:12       ` Andrew Morton
2007-01-25 15:32         ` Serge E. Hallyn
2007-01-26  5:38           ` Serge E. Hallyn
2007-01-26  6:09             ` Andrew Morton
2006-12-19 23:01 ` [PATCH 8/8] user ns: implement user ns unshare Serge E. Hallyn

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=20070124185845.GA597@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome