174bd59bbSPavel Emelyanov /* 274bd59bbSPavel Emelyanov * Pid namespaces 374bd59bbSPavel Emelyanov * 474bd59bbSPavel Emelyanov * Authors: 574bd59bbSPavel Emelyanov * (C) 2007 Pavel Emelyanov <xemul@openvz.org>, OpenVZ, SWsoft Inc. 674bd59bbSPavel Emelyanov * (C) 2007 Sukadev Bhattiprolu <sukadev@us.ibm.com>, IBM 774bd59bbSPavel Emelyanov * Many thanks to Oleg Nesterov for comments and help 874bd59bbSPavel Emelyanov * 974bd59bbSPavel Emelyanov */ 1074bd59bbSPavel Emelyanov 1174bd59bbSPavel Emelyanov #include <linux/pid.h> 1274bd59bbSPavel Emelyanov #include <linux/pid_namespace.h> 1349f4d8b9SEric W. Biederman #include <linux/user_namespace.h> 1474bd59bbSPavel Emelyanov #include <linux/syscalls.h> 1574bd59bbSPavel Emelyanov #include <linux/err.h> 160b6b030fSPavel Emelyanov #include <linux/acct.h> 175a0e3ad6STejun Heo #include <linux/slab.h> 184308eebbSEric W. Biederman #include <linux/proc_fs.h> 19cf3f8921SDaniel Lezcano #include <linux/reboot.h> 20523a6a94SEric W. Biederman #include <linux/export.h> 2174bd59bbSPavel Emelyanov 2274bd59bbSPavel Emelyanov #define BITS_PER_PAGE (PAGE_SIZE*8) 2374bd59bbSPavel Emelyanov 2474bd59bbSPavel Emelyanov struct pid_cache { 2574bd59bbSPavel Emelyanov int nr_ids; 2674bd59bbSPavel Emelyanov char name[16]; 2774bd59bbSPavel Emelyanov struct kmem_cache *cachep; 2874bd59bbSPavel Emelyanov struct list_head list; 2974bd59bbSPavel Emelyanov }; 3074bd59bbSPavel Emelyanov 3174bd59bbSPavel Emelyanov static LIST_HEAD(pid_caches_lh); 3274bd59bbSPavel Emelyanov static DEFINE_MUTEX(pid_caches_mutex); 3374bd59bbSPavel Emelyanov static struct kmem_cache *pid_ns_cachep; 3474bd59bbSPavel Emelyanov 3574bd59bbSPavel Emelyanov /* 3674bd59bbSPavel Emelyanov * creates the kmem cache to allocate pids from. 3774bd59bbSPavel Emelyanov * @nr_ids: the number of numerical ids this pid will have to carry 3874bd59bbSPavel Emelyanov */ 3974bd59bbSPavel Emelyanov 4074bd59bbSPavel Emelyanov static struct kmem_cache *create_pid_cachep(int nr_ids) 4174bd59bbSPavel Emelyanov { 4274bd59bbSPavel Emelyanov struct pid_cache *pcache; 4374bd59bbSPavel Emelyanov struct kmem_cache *cachep; 4474bd59bbSPavel Emelyanov 4574bd59bbSPavel Emelyanov mutex_lock(&pid_caches_mutex); 4674bd59bbSPavel Emelyanov list_for_each_entry(pcache, &pid_caches_lh, list) 4774bd59bbSPavel Emelyanov if (pcache->nr_ids == nr_ids) 4874bd59bbSPavel Emelyanov goto out; 4974bd59bbSPavel Emelyanov 5074bd59bbSPavel Emelyanov pcache = kmalloc(sizeof(struct pid_cache), GFP_KERNEL); 5174bd59bbSPavel Emelyanov if (pcache == NULL) 5274bd59bbSPavel Emelyanov goto err_alloc; 5374bd59bbSPavel Emelyanov 5474bd59bbSPavel Emelyanov snprintf(pcache->name, sizeof(pcache->name), "pid_%d", nr_ids); 5574bd59bbSPavel Emelyanov cachep = kmem_cache_create(pcache->name, 5674bd59bbSPavel Emelyanov sizeof(struct pid) + (nr_ids - 1) * sizeof(struct upid), 5774bd59bbSPavel Emelyanov 0, SLAB_HWCACHE_ALIGN, NULL); 5874bd59bbSPavel Emelyanov if (cachep == NULL) 5974bd59bbSPavel Emelyanov goto err_cachep; 6074bd59bbSPavel Emelyanov 6174bd59bbSPavel Emelyanov pcache->nr_ids = nr_ids; 6274bd59bbSPavel Emelyanov pcache->cachep = cachep; 6374bd59bbSPavel Emelyanov list_add(&pcache->list, &pid_caches_lh); 6474bd59bbSPavel Emelyanov out: 6574bd59bbSPavel Emelyanov mutex_unlock(&pid_caches_mutex); 6674bd59bbSPavel Emelyanov return pcache->cachep; 6774bd59bbSPavel Emelyanov 6874bd59bbSPavel Emelyanov err_cachep: 6974bd59bbSPavel Emelyanov kfree(pcache); 7074bd59bbSPavel Emelyanov err_alloc: 7174bd59bbSPavel Emelyanov mutex_unlock(&pid_caches_mutex); 7274bd59bbSPavel Emelyanov return NULL; 7374bd59bbSPavel Emelyanov } 7474bd59bbSPavel Emelyanov 750a01f2ccSEric W. Biederman static void proc_cleanup_work(struct work_struct *work) 760a01f2ccSEric W. Biederman { 770a01f2ccSEric W. Biederman struct pid_namespace *ns = container_of(work, struct pid_namespace, proc_work); 780a01f2ccSEric W. Biederman pid_ns_release_proc(ns); 790a01f2ccSEric W. Biederman } 800a01f2ccSEric W. Biederman 81f2302505SAndrew Vagin /* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */ 82f2302505SAndrew Vagin #define MAX_PID_NS_LEVEL 32 83f2302505SAndrew Vagin 8449f4d8b9SEric W. Biederman static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns, 8549f4d8b9SEric W. Biederman struct pid_namespace *parent_pid_ns) 8674bd59bbSPavel Emelyanov { 8774bd59bbSPavel Emelyanov struct pid_namespace *ns; 88ed469a63SAlexey Dobriyan unsigned int level = parent_pid_ns->level + 1; 89f2302505SAndrew Vagin int i; 90f2302505SAndrew Vagin int err; 9174bd59bbSPavel Emelyanov 92f2302505SAndrew Vagin if (level > MAX_PID_NS_LEVEL) { 93f2302505SAndrew Vagin err = -EINVAL; 94f2302505SAndrew Vagin goto out; 95f2302505SAndrew Vagin } 96f2302505SAndrew Vagin 97f2302505SAndrew Vagin err = -ENOMEM; 9884406c15SPavel Emelyanov ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); 9974bd59bbSPavel Emelyanov if (ns == NULL) 10074bd59bbSPavel Emelyanov goto out; 10174bd59bbSPavel Emelyanov 10274bd59bbSPavel Emelyanov ns->pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL); 10374bd59bbSPavel Emelyanov if (!ns->pidmap[0].page) 10474bd59bbSPavel Emelyanov goto out_free; 10574bd59bbSPavel Emelyanov 10674bd59bbSPavel Emelyanov ns->pid_cachep = create_pid_cachep(level + 1); 10774bd59bbSPavel Emelyanov if (ns->pid_cachep == NULL) 10874bd59bbSPavel Emelyanov goto out_free_map; 10974bd59bbSPavel Emelyanov 11074bd59bbSPavel Emelyanov kref_init(&ns->kref); 11174bd59bbSPavel Emelyanov ns->level = level; 112ed469a63SAlexey Dobriyan ns->parent = get_pid_ns(parent_pid_ns); 11349f4d8b9SEric W. Biederman ns->user_ns = get_user_ns(user_ns); 1140a01f2ccSEric W. Biederman INIT_WORK(&ns->proc_work, proc_cleanup_work); 11574bd59bbSPavel Emelyanov 11674bd59bbSPavel Emelyanov set_bit(0, ns->pidmap[0].page); 11774bd59bbSPavel Emelyanov atomic_set(&ns->pidmap[0].nr_free, BITS_PER_PAGE - 1); 11874bd59bbSPavel Emelyanov 11984406c15SPavel Emelyanov for (i = 1; i < PIDMAP_ENTRIES; i++) 12074bd59bbSPavel Emelyanov atomic_set(&ns->pidmap[i].nr_free, BITS_PER_PAGE); 12174bd59bbSPavel Emelyanov 12274bd59bbSPavel Emelyanov return ns; 12374bd59bbSPavel Emelyanov 12474bd59bbSPavel Emelyanov out_free_map: 12574bd59bbSPavel Emelyanov kfree(ns->pidmap[0].page); 12674bd59bbSPavel Emelyanov out_free: 12774bd59bbSPavel Emelyanov kmem_cache_free(pid_ns_cachep, ns); 12874bd59bbSPavel Emelyanov out: 1294308eebbSEric W. Biederman return ERR_PTR(err); 13074bd59bbSPavel Emelyanov } 13174bd59bbSPavel Emelyanov 13274bd59bbSPavel Emelyanov static void destroy_pid_namespace(struct pid_namespace *ns) 13374bd59bbSPavel Emelyanov { 13474bd59bbSPavel Emelyanov int i; 13574bd59bbSPavel Emelyanov 13674bd59bbSPavel Emelyanov for (i = 0; i < PIDMAP_ENTRIES; i++) 13774bd59bbSPavel Emelyanov kfree(ns->pidmap[i].page); 13849f4d8b9SEric W. Biederman put_user_ns(ns->user_ns); 13974bd59bbSPavel Emelyanov kmem_cache_free(pid_ns_cachep, ns); 14074bd59bbSPavel Emelyanov } 14174bd59bbSPavel Emelyanov 14249f4d8b9SEric W. Biederman struct pid_namespace *copy_pid_ns(unsigned long flags, 14349f4d8b9SEric W. Biederman struct user_namespace *user_ns, struct pid_namespace *old_ns) 14474bd59bbSPavel Emelyanov { 14574bd59bbSPavel Emelyanov if (!(flags & CLONE_NEWPID)) 146dca4a979SAlexey Dobriyan return get_pid_ns(old_ns); 147e5a47386SSukadev Bhattiprolu if (flags & (CLONE_THREAD|CLONE_PARENT)) 148dca4a979SAlexey Dobriyan return ERR_PTR(-EINVAL); 149225778d6SEric W. Biederman if (task_active_pid_ns(current) != old_ns) 150225778d6SEric W. Biederman return ERR_PTR(-EINVAL); 15149f4d8b9SEric W. Biederman return create_pid_namespace(user_ns, old_ns); 15274bd59bbSPavel Emelyanov } 15374bd59bbSPavel Emelyanov 154bbc2e3efSCyrill Gorcunov static void free_pid_ns(struct kref *kref) 15574bd59bbSPavel Emelyanov { 156bbc2e3efSCyrill Gorcunov struct pid_namespace *ns; 15774bd59bbSPavel Emelyanov 15874bd59bbSPavel Emelyanov ns = container_of(kref, struct pid_namespace, kref); 15974bd59bbSPavel Emelyanov destroy_pid_namespace(ns); 16074bd59bbSPavel Emelyanov } 161bbc2e3efSCyrill Gorcunov 162bbc2e3efSCyrill Gorcunov void put_pid_ns(struct pid_namespace *ns) 163bbc2e3efSCyrill Gorcunov { 164bbc2e3efSCyrill Gorcunov struct pid_namespace *parent; 165bbc2e3efSCyrill Gorcunov 166bbc2e3efSCyrill Gorcunov while (ns != &init_pid_ns) { 167bbc2e3efSCyrill Gorcunov parent = ns->parent; 168bbc2e3efSCyrill Gorcunov if (!kref_put(&ns->kref, free_pid_ns)) 169bbc2e3efSCyrill Gorcunov break; 170bbc2e3efSCyrill Gorcunov ns = parent; 171bbc2e3efSCyrill Gorcunov } 172bbc2e3efSCyrill Gorcunov } 173bbc2e3efSCyrill Gorcunov EXPORT_SYMBOL_GPL(put_pid_ns); 17474bd59bbSPavel Emelyanov 17574bd59bbSPavel Emelyanov void zap_pid_ns_processes(struct pid_namespace *pid_ns) 17674bd59bbSPavel Emelyanov { 17774bd59bbSPavel Emelyanov int nr; 17874bd59bbSPavel Emelyanov int rc; 17900c10bc1SEric W. Biederman struct task_struct *task, *me = current; 18000c10bc1SEric W. Biederman 18100c10bc1SEric W. Biederman /* Ignore SIGCHLD causing any terminated children to autoreap */ 18200c10bc1SEric W. Biederman spin_lock_irq(&me->sighand->siglock); 18300c10bc1SEric W. Biederman me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN; 18400c10bc1SEric W. Biederman spin_unlock_irq(&me->sighand->siglock); 18574bd59bbSPavel Emelyanov 18674bd59bbSPavel Emelyanov /* 18774bd59bbSPavel Emelyanov * The last thread in the cgroup-init thread group is terminating. 18874bd59bbSPavel Emelyanov * Find remaining pid_ts in the namespace, signal and wait for them 18974bd59bbSPavel Emelyanov * to exit. 19074bd59bbSPavel Emelyanov * 19174bd59bbSPavel Emelyanov * Note: This signals each threads in the namespace - even those that 19274bd59bbSPavel Emelyanov * belong to the same thread group, To avoid this, we would have 19374bd59bbSPavel Emelyanov * to walk the entire tasklist looking a processes in this 19474bd59bbSPavel Emelyanov * namespace, but that could be unnecessarily expensive if the 19574bd59bbSPavel Emelyanov * pid namespace has just a few processes. Or we need to 19674bd59bbSPavel Emelyanov * maintain a tasklist for each pid namespace. 19774bd59bbSPavel Emelyanov * 19874bd59bbSPavel Emelyanov */ 19974bd59bbSPavel Emelyanov read_lock(&tasklist_lock); 20074bd59bbSPavel Emelyanov nr = next_pidmap(pid_ns, 1); 20174bd59bbSPavel Emelyanov while (nr > 0) { 202e4da026fSSukadev Bhattiprolu rcu_read_lock(); 203e4da026fSSukadev Bhattiprolu 204e4da026fSSukadev Bhattiprolu task = pid_task(find_vpid(nr), PIDTYPE_PID); 205a02d6fd6SOleg Nesterov if (task && !__fatal_signal_pending(task)) 206a02d6fd6SOleg Nesterov send_sig_info(SIGKILL, SEND_SIG_FORCED, task); 207e4da026fSSukadev Bhattiprolu 208e4da026fSSukadev Bhattiprolu rcu_read_unlock(); 209e4da026fSSukadev Bhattiprolu 21074bd59bbSPavel Emelyanov nr = next_pidmap(pid_ns, nr); 21174bd59bbSPavel Emelyanov } 21274bd59bbSPavel Emelyanov read_unlock(&tasklist_lock); 21374bd59bbSPavel Emelyanov 2146347e900SEric W. Biederman /* Firstly reap the EXIT_ZOMBIE children we may have. */ 21574bd59bbSPavel Emelyanov do { 21674bd59bbSPavel Emelyanov clear_thread_flag(TIF_SIGPENDING); 21774bd59bbSPavel Emelyanov rc = sys_wait4(-1, NULL, __WALL, NULL); 21874bd59bbSPavel Emelyanov } while (rc != -ECHILD); 21974bd59bbSPavel Emelyanov 2206347e900SEric W. Biederman /* 2216347e900SEric W. Biederman * sys_wait4() above can't reap the TASK_DEAD children. 222af4b8a83SEric W. Biederman * Make sure they all go away, see free_pid(). 2236347e900SEric W. Biederman */ 2246347e900SEric W. Biederman for (;;) { 225af4b8a83SEric W. Biederman set_current_state(TASK_UNINTERRUPTIBLE); 226af4b8a83SEric W. Biederman if (pid_ns->nr_hashed == 1) 2276347e900SEric W. Biederman break; 2286347e900SEric W. Biederman schedule(); 2296347e900SEric W. Biederman } 230af4b8a83SEric W. Biederman __set_current_state(TASK_RUNNING); 2316347e900SEric W. Biederman 232cf3f8921SDaniel Lezcano if (pid_ns->reboot) 233cf3f8921SDaniel Lezcano current->signal->group_exit_code = pid_ns->reboot; 234cf3f8921SDaniel Lezcano 2350b6b030fSPavel Emelyanov acct_exit_ns(pid_ns); 23674bd59bbSPavel Emelyanov return; 23774bd59bbSPavel Emelyanov } 23874bd59bbSPavel Emelyanov 23998ed57eeSCyrill Gorcunov #ifdef CONFIG_CHECKPOINT_RESTORE 240b8f566b0SPavel Emelyanov static int pid_ns_ctl_handler(struct ctl_table *table, int write, 241b8f566b0SPavel Emelyanov void __user *buffer, size_t *lenp, loff_t *ppos) 242b8f566b0SPavel Emelyanov { 24349f4d8b9SEric W. Biederman struct pid_namespace *pid_ns = task_active_pid_ns(current); 244b8f566b0SPavel Emelyanov struct ctl_table tmp = *table; 245b8f566b0SPavel Emelyanov 24649f4d8b9SEric W. Biederman if (write && !ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN)) 247b8f566b0SPavel Emelyanov return -EPERM; 248b8f566b0SPavel Emelyanov 249b8f566b0SPavel Emelyanov /* 250b8f566b0SPavel Emelyanov * Writing directly to ns' last_pid field is OK, since this field 251b8f566b0SPavel Emelyanov * is volatile in a living namespace anyway and a code writing to 252b8f566b0SPavel Emelyanov * it should synchronize its usage with external means. 253b8f566b0SPavel Emelyanov */ 254b8f566b0SPavel Emelyanov 25549f4d8b9SEric W. Biederman tmp.data = &pid_ns->last_pid; 256579035dcSAndrew Vagin return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); 257b8f566b0SPavel Emelyanov } 258b8f566b0SPavel Emelyanov 259579035dcSAndrew Vagin extern int pid_max; 260579035dcSAndrew Vagin static int zero = 0; 261b8f566b0SPavel Emelyanov static struct ctl_table pid_ns_ctl_table[] = { 262b8f566b0SPavel Emelyanov { 263b8f566b0SPavel Emelyanov .procname = "ns_last_pid", 264b8f566b0SPavel Emelyanov .maxlen = sizeof(int), 265b8f566b0SPavel Emelyanov .mode = 0666, /* permissions are checked in the handler */ 266b8f566b0SPavel Emelyanov .proc_handler = pid_ns_ctl_handler, 267579035dcSAndrew Vagin .extra1 = &zero, 268579035dcSAndrew Vagin .extra2 = &pid_max, 269b8f566b0SPavel Emelyanov }, 270b8f566b0SPavel Emelyanov { } 271b8f566b0SPavel Emelyanov }; 272b8f566b0SPavel Emelyanov static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } }; 27398ed57eeSCyrill Gorcunov #endif /* CONFIG_CHECKPOINT_RESTORE */ 274b8f566b0SPavel Emelyanov 275cf3f8921SDaniel Lezcano int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) 276cf3f8921SDaniel Lezcano { 277cf3f8921SDaniel Lezcano if (pid_ns == &init_pid_ns) 278cf3f8921SDaniel Lezcano return 0; 279cf3f8921SDaniel Lezcano 280cf3f8921SDaniel Lezcano switch (cmd) { 281cf3f8921SDaniel Lezcano case LINUX_REBOOT_CMD_RESTART2: 282cf3f8921SDaniel Lezcano case LINUX_REBOOT_CMD_RESTART: 283cf3f8921SDaniel Lezcano pid_ns->reboot = SIGHUP; 284cf3f8921SDaniel Lezcano break; 285cf3f8921SDaniel Lezcano 286cf3f8921SDaniel Lezcano case LINUX_REBOOT_CMD_POWER_OFF: 287cf3f8921SDaniel Lezcano case LINUX_REBOOT_CMD_HALT: 288cf3f8921SDaniel Lezcano pid_ns->reboot = SIGINT; 289cf3f8921SDaniel Lezcano break; 290cf3f8921SDaniel Lezcano default: 291cf3f8921SDaniel Lezcano return -EINVAL; 292cf3f8921SDaniel Lezcano } 293cf3f8921SDaniel Lezcano 294cf3f8921SDaniel Lezcano read_lock(&tasklist_lock); 295cf3f8921SDaniel Lezcano force_sig(SIGKILL, pid_ns->child_reaper); 296cf3f8921SDaniel Lezcano read_unlock(&tasklist_lock); 297cf3f8921SDaniel Lezcano 298cf3f8921SDaniel Lezcano do_exit(0); 299cf3f8921SDaniel Lezcano 300cf3f8921SDaniel Lezcano /* Not reached */ 301cf3f8921SDaniel Lezcano return 0; 302cf3f8921SDaniel Lezcano } 303cf3f8921SDaniel Lezcano 304*57e8391dSEric W. Biederman static void *pidns_get(struct task_struct *task) 305*57e8391dSEric W. Biederman { 306*57e8391dSEric W. Biederman struct pid_namespace *ns; 307*57e8391dSEric W. Biederman 308*57e8391dSEric W. Biederman rcu_read_lock(); 309*57e8391dSEric W. Biederman ns = get_pid_ns(task_active_pid_ns(task)); 310*57e8391dSEric W. Biederman rcu_read_unlock(); 311*57e8391dSEric W. Biederman 312*57e8391dSEric W. Biederman return ns; 313*57e8391dSEric W. Biederman } 314*57e8391dSEric W. Biederman 315*57e8391dSEric W. Biederman static void pidns_put(void *ns) 316*57e8391dSEric W. Biederman { 317*57e8391dSEric W. Biederman put_pid_ns(ns); 318*57e8391dSEric W. Biederman } 319*57e8391dSEric W. Biederman 320*57e8391dSEric W. Biederman static int pidns_install(struct nsproxy *nsproxy, void *ns) 321*57e8391dSEric W. Biederman { 322*57e8391dSEric W. Biederman struct pid_namespace *active = task_active_pid_ns(current); 323*57e8391dSEric W. Biederman struct pid_namespace *ancestor, *new = ns; 324*57e8391dSEric W. Biederman 325*57e8391dSEric W. Biederman if (!ns_capable(new->user_ns, CAP_SYS_ADMIN)) 326*57e8391dSEric W. Biederman return -EPERM; 327*57e8391dSEric W. Biederman 328*57e8391dSEric W. Biederman /* 329*57e8391dSEric W. Biederman * Only allow entering the current active pid namespace 330*57e8391dSEric W. Biederman * or a child of the current active pid namespace. 331*57e8391dSEric W. Biederman * 332*57e8391dSEric W. Biederman * This is required for fork to return a usable pid value and 333*57e8391dSEric W. Biederman * this maintains the property that processes and their 334*57e8391dSEric W. Biederman * children can not escape their current pid namespace. 335*57e8391dSEric W. Biederman */ 336*57e8391dSEric W. Biederman if (new->level < active->level) 337*57e8391dSEric W. Biederman return -EINVAL; 338*57e8391dSEric W. Biederman 339*57e8391dSEric W. Biederman ancestor = new; 340*57e8391dSEric W. Biederman while (ancestor->level > active->level) 341*57e8391dSEric W. Biederman ancestor = ancestor->parent; 342*57e8391dSEric W. Biederman if (ancestor != active) 343*57e8391dSEric W. Biederman return -EINVAL; 344*57e8391dSEric W. Biederman 345*57e8391dSEric W. Biederman put_pid_ns(nsproxy->pid_ns); 346*57e8391dSEric W. Biederman nsproxy->pid_ns = get_pid_ns(new); 347*57e8391dSEric W. Biederman return 0; 348*57e8391dSEric W. Biederman } 349*57e8391dSEric W. Biederman 350*57e8391dSEric W. Biederman const struct proc_ns_operations pidns_operations = { 351*57e8391dSEric W. Biederman .name = "pid", 352*57e8391dSEric W. Biederman .type = CLONE_NEWPID, 353*57e8391dSEric W. Biederman .get = pidns_get, 354*57e8391dSEric W. Biederman .put = pidns_put, 355*57e8391dSEric W. Biederman .install = pidns_install, 356*57e8391dSEric W. Biederman }; 357*57e8391dSEric W. Biederman 35874bd59bbSPavel Emelyanov static __init int pid_namespaces_init(void) 35974bd59bbSPavel Emelyanov { 36074bd59bbSPavel Emelyanov pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC); 36198ed57eeSCyrill Gorcunov 36298ed57eeSCyrill Gorcunov #ifdef CONFIG_CHECKPOINT_RESTORE 363b8f566b0SPavel Emelyanov register_sysctl_paths(kern_path, pid_ns_ctl_table); 36498ed57eeSCyrill Gorcunov #endif 36574bd59bbSPavel Emelyanov return 0; 36674bd59bbSPavel Emelyanov } 36774bd59bbSPavel Emelyanov 36874bd59bbSPavel Emelyanov __initcall(pid_namespaces_init); 369