lkml.org 
[lkml]   [2020]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 13/23] user: Add user namespaces into ns_idr
From
Date
Now they are exposed in /proc/namespace/ directory.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
kernel/user_namespace.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 367a942bb484..bbfd7f0f9e7c 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -137,7 +137,13 @@ int create_user_ns(struct cred *new)
goto fail_keyring;

set_cred_user_ns(new, ns);
+
+ if (ns_idr_register(&ns->ns))
+ goto fail_sysctl;
+
return 0;
+fail_sysctl:
+ retire_userns_sysctls(ns);
fail_keyring:
#ifdef CONFIG_PERSISTENT_KEYRINGS
key_put(ns->persistent_keyring_register);
@@ -186,6 +192,7 @@ static void free_user_ns(struct work_struct *work)
do {
struct ucounts *ucounts = ns->ucounts;
parent = ns->parent;
+ ns_idr_unregister(&ns->ns);
if (ns->gid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) {
kfree(ns->gid_map.forward);
kfree(ns->gid_map.reverse);
@@ -1327,6 +1334,7 @@ const struct proc_ns_operations userns_operations = {
static __init int user_namespaces_init(void)
{
user_ns_cachep = KMEM_CACHE(user_namespace, SLAB_PANIC);
- return 0;
+
+ return ns_idr_register(&init_user_ns.ns);
}
subsys_initcall(user_namespaces_init);

\
 
 \ /
  Last update: 2020-07-30 14:00    [W:0.279 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site