lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Jul 2020 15:00:51 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     viro@...iv.linux.org.uk, adobriyan@...il.com, davem@...emloft.net,
        ebiederm@...ssion.com, akpm@...ux-foundation.org,
        christian.brauner@...ntu.com, areber@...hat.com, serge@...lyn.com,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        ktkhai@...tuozzo.com
Subject: [PATCH 17/23] pid: Add pid namespaces into ns_idr

Now they are exposed in /proc/namespace/ directory.

Note, that we already wait RCU grace period before
pid namespace's memory is freed.

Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
---
 kernel/pid_namespace.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index da8490390f51..06398a7c4c59 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -109,8 +109,13 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
 	ns->ucounts = ucounts;
 	ns->pid_allocated = PIDNS_ADDING;
 
+	if (ns_idr_register(&ns->ns) < 0)
+		goto out_free_inum;
+
 	return ns;
 
+out_free_inum:
+	ns_free_inum(&ns->ns);
 out_free_idr:
 	idr_destroy(&ns->idr);
 	kmem_cache_free(pid_ns_cachep, ns);
@@ -132,6 +137,7 @@ static void delayed_free_pidns(struct rcu_head *p)
 
 static void destroy_pid_namespace(struct pid_namespace *ns)
 {
+	ns_idr_unregister(&ns->ns);
 	ns_free_inum(&ns->ns);
 
 	idr_destroy(&ns->idr);
@@ -466,6 +472,7 @@ static __init int pid_namespaces_init(void)
 #ifdef CONFIG_CHECKPOINT_RESTORE
 	register_sysctl_paths(kern_path, pid_ns_ctl_table);
 #endif
+	WARN_ON(ns_idr_register(&init_pid_ns.ns) < 0);
 	return 0;
 }
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ