Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-24 Thread W. Trevor King
On Sun, Jul 24, 2016 at 09:30:03AM -0500, Eric W. Biederman wrote: > I am not at all certain it makes sense to return -ENOENT. > > Without the -ENOENT check the code is much cleaner, and clearer. This is fine with me, and makes even more sense for owner (user) namespaces than it does for net name

Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-24 Thread W. Trevor King
On Thu, Jul 14, 2016 at 07:12:19PM -0700, Andrey Vagin wrote: > +struct ns_common *ns_get_owner(struct ns_common *ns) > +{ > + … > + return &get_user_ns(user_ns)->ns; > +} Is there a reason to return the generic ‘struct ns_common *’ here instead of ‘struct user_namespace *’? The current u

Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-24 Thread Eric W. Biederman
Andrew Vagin writes: > On Sun, Jul 24, 2016 at 12:03:49AM -0500, Eric W. Biederman wrote: >> Andrey Vagin writes: >> >> > Return -EPERM if an owning user namespace is outside of a process >> > current user namespace. >> > >> > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c >> >

Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-24 Thread Andrew Vagin
On Sun, Jul 24, 2016 at 12:03:49AM -0500, Eric W. Biederman wrote: > Andrey Vagin writes: > > > Return -EPERM if an owning user namespace is outside of a process > > current user namespace. > > > > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > > index a5bc78c..6382e5e 100644 >

Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-23 Thread Eric W. Biederman
Andrey Vagin writes: > Return -EPERM if an owning user namespace is outside of a process > current user namespace. > > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > index a5bc78c..6382e5e 100644 > --- a/kernel/user_namespace.c > +++ b/kernel/user_namespace.c > @@ -994,6 +994,30

[PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-14 Thread Andrey Vagin
Return -EPERM if an owning user namespace is outside of a process current user namespace. Signed-off-by: Andrey Vagin --- include/linux/user_namespace.h | 7 +++ kernel/user_namespace.c| 24 2 files changed, 31 insertions(+) diff --git a/include/linux/user_

Re: [PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-14 Thread W. Trevor King
On Thu, Jul 14, 2016 at 11:20:16AM -0700, Andrey Vagin wrote: > +struct ns_common *ns_get_owner(struct ns_common *ns) > +{ > + const struct cred *cred = current_cred(); > + struct user_namespace *user_ns, *p; > + > + user_ns = p = ns->user_ns; > + if (user_ns == NULL) { /* ns is ini

[PATCH 2/5] kernel: add a helper to get an owning user namespace for a namespace

2016-07-14 Thread Andrey Vagin
Return -EPERM if an owning user namespace is outside of a process current user namespace. Signed-off-by: Andrey Vagin --- include/linux/user_namespace.h | 7 +++ kernel/user_namespace.c| 24 2 files changed, 31 insertions(+) diff --git a/include/linux/user_