Skip to content

Pid namespaces

Pavel Emelyanov containers lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest20 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20Reowrk forget_original_parent()kernel/exit.c+21 -180 replies
2/20Move exit_task_namespaces()kernel/exit.c+1 -10 replies
3/20Introduce MS_KERNMOUNT flagfs/namespace.c fs/super.c include/linux/fs.h+8 -53 replies
4/20Prepare proc_flust_task() to flush entries from multiple proc treesfs/proc/base.c include/linux/proc_fs.h kernel/exit.c+24 -90 replies
5/20Introduce struct upidinclude/linux/init_task.h include/linux/pid.h+22 -02 replies
6/20Add support for pid namespaces hierarchyinclude/linux/pid_namespace.h kernel/pid.c+4 -10 replies
7/20Make alloc_pid(), free_pid() and put_pid() work with struct upidinclude/linux/pid.h kernel/fork.c kernel/pid.c+36 -170 replies
8/20Helpers to obtain pid numbersinclude/linux/pid.h include/linux/sched.h kernel/pid.c+134 -110 replies
9/20Helpers to find the task by its numerical idsfs/proc/base.c include/linux/pid.h include/linux/sched.h +1 more+69 -220 replies
10/20Move alloc_pid() lower in copy_process()kernel/fork.c+16 -150 replies
11/20Make proc have multiple superblocks - one for each namespacefs/proc/inode.c fs/proc/root.c include/linux/pid_namespace.h +1 more+69 -60 replies
12/20Miscelaneous preparations for pid namespacesinclude/linux/pid_namespace.h include/linux/sched.h kernel/pid.c+25 -180 replies
13/20Allow cloning of new namespaceinclude/linux/sched.h kernel/fork.c kernel/nsproxy.c +1 more+119 -250 replies
14/20Make proc_flush_task() actually from entries from multiple namespacesfs/proc/base.c+16 -20 replies
15/20Initialize the namespace's proc_mntfs/proc/base.c fs/proc/root.c include/linux/proc_fs.h +1 more+39 -00 replies
16/20Create a slab-cache for 'struct pid_namespace'kernel/pid.c+6 -30 replies
17/20Allow signalling container-initkernel/signal.c+2 -40 replies
18/20Destroy pid namespace on init's deathinclude/linux/pid.h kernel/exit.c kernel/pid.c+65 -10 replies
19/20Changes to show virtual ids to userarch/ia64/kernel/signal.c arch/parisc/kernel/signal.c arch/sparc/kernel/sys_sunos.c +25 more+212 -1312 replies
20/20Remove the struct pid unneeded fieldsinclude/linux/init_task.h include/linux/pid.h kernel/pid.c+0 -70 replies

Reviews trailers per patch

2 of 20 patches have a Reviewed-by or Acked-by.

PatchPavel Emelyanov
1/20
2/20
3/20
4/20
5/20
6/20
7/20
8/20
9/20
10/20
11/20
12/20
13/20
14/20
15/20
16/20
17/20A-b
18/20A-b
19/20
20/20

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/20] Pid namespaces

A pid namespace is a "view" of a particular set of tasks on the system. They work in a similar way to filesystem namespaces. A file (or a process) can be accessed in multiple namespaces, but it may have a different name in each. In a filesystem, this name might be /etc/passwd in one namespace, but /chroot/etc/passwd in another.

For processes, a process may have pid 1234 in one namespace, but be pid 1 in another. This allows new pid namespaces to have basically arbitrary pids, and not have to worry about what pids exist in other namespaces. This is essential for checkpoint/restart where a restarted process's pid might collide with an existing process on the system's pid.

In this particular implementation, pid namespaces have a parent-child relationship, just like processes. A process in a pid namespace may see all of the processes in the same namespace, as well as all of the processes in all of the namespaces which are children of its namespace. Processes may not, however, see others which are in their parent's namespace, but not in their own. The same goes for sibling namespaces.

The know issue to be solved in the nearest future is signal handling in the namespace boundary. That is, currently the namespace's init is treated like an ordinary task that can be killed from within an namespace. Ideally, the signal handling by the namespace's init should have two sides: when signaling the init from its namespace, the init should look like a real init task, i.e. receive only those signals, that is explicitly wants to; when signaling the init from one of the parent namespaces, init should look like an ordinary task, i.e. receive any signal, only taking the general permissions into account.

The pid namespace was developed by Pavel Emlyanov and Sukadev Bhattiprolu
and we eventually came to almost the same implementation, which differed
in some details. This set is based on Pavel's patches, but it includes comments and patches that from Sukadev.

Many thanks to Oleg, who reviewed the patches, pointed out many BUGs and made valuable advises on how to make this set cleaner.