Linux userland API discussions
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Stéphane Graber" <stgraber@ubuntu.com>,
	"Linux Containers" <containers@lists.linux-foundation.org>,
	"Serge Hallyn" <serge@hallyn.com>, "Jann Horn" <jannh@google.com>,
	"Michael Kerrisk" <mtk.manpages@gmail.com>,
	"Aleksa Sarai" <cyphar@cyphar.com>,
	linux-api@vger.kernel.org
Subject: Re: [PATCH v3 1/3] nsproxy: add struct nsset
Date: Mon, 4 May 2020 18:25:17 +0200	[thread overview]
Message-ID: <20200504162517.vjcbwj5ynaqdn2k4@wittgenstein> (raw)
In-Reply-To: <87wo5roev9.fsf@x220.int.ebiederm.org>

On Mon, May 04, 2020 at 11:15:54AM -0500, Eric W. Biederman wrote:
> Christian Brauner <christian.brauner@ubuntu.com> writes:
> 
> > Add a simple struct nsset. It holds all necessary pieces to switch to a new
> > set of namespaces without leaving a task in a half-switched state which we
> > will make use of in the next patch. This patch simply switches the existing
> > setns logic over without causing a change in setns() behavior. This brings
> > setns() closer to how unshare() works(). The prepare_ns() function is
> > responsible to prepare all necessary information. This has two reasons.
> > First it minimizes dependencies between individual namespaces, i.e. all
> > install handler can expect that all fields are properly initialized
> > independent in what order they are called in. Second, this makes the code
> > easier to maintain and easier to follow if it needs to be changed.
> 
> This is buggy.
> 
> Your code assume that nstype == 0 is invalid.

Yep, good catch! That's a bug from rearranging the patches.

> 
> Passing nstype == 0 means don't verify the kind of file descriptor
> passed.
> 
> Quite frankly doing nstype & CLONE_XYZ is wrong.  It always
> needs to be nstype == CLONE_XYZ.

I mean, I can do the nstype == CLONE_NEW* in the preparatory patch and
then switch to flags & CLONE_NEW* later.

Let me fix this right now.

Christian

  reply	other threads:[~2020-05-04 16:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 14:41 [PATCH v3 0/3] nsproxy: attach to multiple namespaces Christian Brauner
2020-05-04 14:41 ` [PATCH v3 1/3] nsproxy: add struct nsset Christian Brauner
2020-05-04 16:15   ` Eric W. Biederman
2020-05-04 16:25     ` Christian Brauner [this message]
2020-05-04 14:41 ` [PATCH v3 2/3] nsproxy: attach to namespaces via pidfds Christian Brauner
2020-05-04 16:25   ` Eric W. Biederman
2020-05-04 16:39     ` Christian Brauner
2020-05-04 17:09       ` Eric W. Biederman
2020-05-04 17:50         ` Christian Brauner
2020-05-04 14:41 ` [PATCH v3 3/3] selftests/pidfd: add pidfd setns tests Christian Brauner

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=20200504162517.vjcbwj5ynaqdn2k4@wittgenstein \
    --to=christian.brauner@ubuntu.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=cyphar@cyphar.com \
    --cc=ebiederm@xmission.com \
    --cc=jannh@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=serge@hallyn.com \
    --cc=stgraber@ubuntu.com \
    --cc=viro@zeniv.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