Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1472989
| From | "Serge E. Hallyn" <serge@hallyn.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace |
| Date | 2016-08-31 04:50 +0200 |
| Message-ID | <sc3Lc-4Ze-3@gated-at.bofh.it> (permalink) |
| References | <sayq5-56V-15@gated-at.bofh.it> <sayq5-56V-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Aug 26, 2016 at 04:08:08PM -0700, Andrei Vagin wrote:
> From: Andrey Vagin <avagin@openvz.org>
>
> Return -EPERM if an owning user namespace is outside of a process
> current user namespace.
>
> v2: In a first version ns_get_owner returned ENOENT for init_user_ns.
> This special cases was removed from this version. There is nothing
> outside of init_user_ns, so we can return EPERM.
>
> Signed-off-by: Andrei Vagin <avagin@openvz.org>
> ---
> fs/namespace.c | 6 ++++++
> include/linux/proc_ns.h | 1 +
> include/linux/user_namespace.h | 7 +++++++
> ipc/namespace.c | 6 ++++++
> kernel/cgroup.c | 6 ++++++
> kernel/pid_namespace.c | 6 ++++++
> kernel/user_namespace.c | 24 ++++++++++++++++++++++++
> kernel/utsname.c | 6 ++++++
> net/core/net_namespace.c | 6 ++++++
> 9 files changed, 68 insertions(+)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 491b8f3..f985817 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -3368,10 +3368,16 @@ static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns)
> return 0;
> }
>
> +static struct user_namespace *mntns_get_owner(struct ns_common *ns)
> +{
> + return to_mnt_ns(ns)->user_ns;
Hi - sorry to be pedantic here, but *_get_owner makes me think
it will grab a reference too. A bit unfortunate, maybe it doesn't
matter, but would mntns_owner(), netns_owner(), etc be better?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4 v2] Add an interface to discover relationships between namespaces Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 2/4] nsfs: add ioctl to get an owning user namespace for ns file descriptor Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 4/4] tools/testing: add a test to check nsfs ioctl-s Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 3/4] nsfs: add ioctl to get a parent namespace Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-08-31 04:50 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrey Vagin <avagin@openvz.org> - 2016-08-31 23:20 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-09-01 00:00 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-08-31 05:00 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrey Vagin <avagin@openvz.org> - 2016-08-31 22:40 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-09-01 07:20 +0200
csiph-web