[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200504162517.vjcbwj5ynaqdn2k4@wittgenstein>
Date: Mon, 4 May 2020 18:25:17 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>,
Stéphane Graber <stgraber@...ntu.com>,
Linux Containers <containers@...ts.linux-foundation.org>,
Serge Hallyn <serge@...lyn.com>, Jann Horn <jannh@...gle.com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Aleksa Sarai <cyphar@...har.com>, linux-api@...r.kernel.org
Subject: Re: [PATCH v3 1/3] nsproxy: add struct nsset
On Mon, May 04, 2020 at 11:15:54AM -0500, Eric W. Biederman wrote:
> Christian Brauner <christian.brauner@...ntu.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
Powered by blists - more mailing lists