Lines Matching +full:0 +full:ns
42 /* Level 0 is init_pid_ns.pid_cachep */ in create_pid_cachep()
57 *pkc = kmem_cache_create(name, len, 0, in create_pid_cachep()
64 static struct ucounts *inc_pid_namespaces(struct user_namespace *ns) in inc_pid_namespaces() argument
66 return inc_ucount(ns, current_euid(), UCOUNT_PID_NAMESPACES); in inc_pid_namespaces()
79 struct pid_namespace *ns; in create_pid_namespace() local
96 ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); in create_pid_namespace()
97 if (ns == NULL) in create_pid_namespace()
100 idr_init(&ns->idr); in create_pid_namespace()
102 ns->pid_cachep = create_pid_cachep(level); in create_pid_namespace()
103 if (ns->pid_cachep == NULL) in create_pid_namespace()
106 err = ns_common_init(ns); in create_pid_namespace()
110 ns->pid_max = PID_MAX_LIMIT; in create_pid_namespace()
111 err = register_pidns_sysctls(ns); in create_pid_namespace()
115 ns->level = level; in create_pid_namespace()
116 ns->parent = get_pid_ns(parent_pid_ns); in create_pid_namespace()
117 ns->user_ns = get_user_ns(user_ns); in create_pid_namespace()
118 ns->ucounts = ucounts; in create_pid_namespace()
119 ns->pid_allocated = PIDNS_ADDING; in create_pid_namespace()
120 INIT_WORK(&ns->work, destroy_pid_namespace_work); in create_pid_namespace()
123 ns->memfd_noexec_scope = pidns_memfd_noexec_scope(parent_pid_ns); in create_pid_namespace()
126 ns_tree_add(ns); in create_pid_namespace()
127 return ns; in create_pid_namespace()
130 ns_common_free(ns); in create_pid_namespace()
132 idr_destroy(&ns->idr); in create_pid_namespace()
133 kmem_cache_free(pid_ns_cachep, ns); in create_pid_namespace()
142 struct pid_namespace *ns = container_of(p, struct pid_namespace, rcu); in delayed_free_pidns() local
144 dec_pid_namespaces(ns->ucounts); in delayed_free_pidns()
145 put_user_ns(ns->user_ns); in delayed_free_pidns()
147 kmem_cache_free(pid_ns_cachep, ns); in delayed_free_pidns()
150 static void destroy_pid_namespace(struct pid_namespace *ns) in destroy_pid_namespace() argument
152 ns_tree_remove(ns); in destroy_pid_namespace()
153 unregister_pidns_sysctls(ns); in destroy_pid_namespace()
155 ns_common_free(ns); in destroy_pid_namespace()
157 idr_destroy(&ns->idr); in destroy_pid_namespace()
158 call_rcu(&ns->rcu, delayed_free_pidns); in destroy_pid_namespace()
163 struct pid_namespace *ns = in destroy_pid_namespace_work() local
169 parent = ns->parent; in destroy_pid_namespace_work()
170 destroy_pid_namespace(ns); in destroy_pid_namespace_work()
171 ns = parent; in destroy_pid_namespace_work()
172 } while (ns != &init_pid_ns && ns_ref_put(ns)); in destroy_pid_namespace_work()
185 void put_pid_ns(struct pid_namespace *ns) in put_pid_ns() argument
187 if (ns && ns != &init_pid_ns && ns_ref_put(ns)) in put_pid_ns()
188 schedule_work(&ns->work); in put_pid_ns()
322 return 0; in reboot_pid_ns()
342 do_exit(0); in reboot_pid_ns()
345 return 0; in reboot_pid_ns()
350 struct pid_namespace *ns; in pidns_get() local
353 ns = task_active_pid_ns(task); in pidns_get()
354 if (ns) in pidns_get()
355 get_pid_ns(ns); in pidns_get()
358 return ns ? &ns->ns : NULL; in pidns_get()
363 struct pid_namespace *ns = NULL; in pidns_for_children_get() local
367 ns = task->nsproxy->pid_ns_for_children; in pidns_for_children_get()
368 get_pid_ns(ns); in pidns_for_children_get()
372 if (ns) { in pidns_for_children_get()
374 if (!ns->child_reaper) { in pidns_for_children_get()
375 put_pid_ns(ns); in pidns_for_children_get()
376 ns = NULL; in pidns_for_children_get()
381 return ns ? &ns->ns : NULL; in pidns_for_children_get()
384 static void pidns_put(struct ns_common *ns) in pidns_put() argument
386 put_pid_ns(to_pid_ns(ns)); in pidns_put()
392 struct pid_namespace *ns; in pidns_is_ancestor() local
396 for (ns = child; ns->level > ancestor->level; ns = ns->parent) in pidns_is_ancestor()
398 return ns == ancestor; in pidns_is_ancestor()
401 static int pidns_install(struct nsset *nsset, struct ns_common *ns) in pidns_install() argument
405 struct pid_namespace *new = to_pid_ns(ns); in pidns_install()
424 return 0; in pidns_install()
427 static struct ns_common *pidns_get_parent(struct ns_common *ns) in pidns_get_parent() argument
433 pid_ns = p = to_pid_ns(ns)->parent; in pidns_get_parent()
442 return &get_pid_ns(pid_ns)->ns; in pidns_get_parent()
445 static struct user_namespace *pidns_owner(struct ns_common *ns) in pidns_owner() argument
447 return to_pid_ns(ns)->user_ns; in pidns_owner()
479 return 0; in pid_namespaces_init()