User: Password:
Subscribe / Log in / New account

[RFC][PATCH 0/3] fork: Add the ability to create tasks with given pids

From:  Pavel Emelyanov <>
To:  Linus Torvalds <>, Andrew Morton <>, Alan Cox <>, Roland McGrath <>, Linux Kernel Mailing List <>
Subject:  [RFC][PATCH 0/3] fork: Add the ability to create tasks with given pids
Date:  Thu, 17 Nov 2011 15:41:47 +0400
Message-ID:  <>
Cc:  Tejun Heo <>, Oleg Nesterov <>, Cyrill Gorcunov <>, James Bottomley <>
Archive-link:  Article

Gentlemen, please, find some time for this, your ACK/NACK on the API proposal
is required badly.

There's currently a work in progress with checkpoint-restore functionality
in the userspace. Most of the API for doing this kernel already provides, but
sometimes it's not enough. One of the required things is the ability to
create a process with its pids (in different pid namespaces) set to some
given values, rather than generated. Currently kernel doesn't allow for this,
so an API extension is required.

The proposal is to introduce the CLONE_CHILD_USEPIDS flag for clone() syscall
and pass the pids values in the child_tidptr. In order not to introduce the
hole for the pid-reuse attack, using this flag will result in EPERM in case
the pid namespace we're trying to create pid in has at least one pid (except
for the init's one) generated with regular fork()/clone().

Currently Tejun and Oleg are worrying only about the intrusiveness of this
approach, although Oleg agrees, that it solves all the problems it should. The
previous attempts to implement the similar stuff stopped, but no objections
against this were expressed. So the decision of whether it's OK to go this
way or not is required.

The API will be used like in the code below

	/* restore new pid namespace with an init in it */
	pid = clone(CLONE_NEWPID);
	if (pid)
		return 0;

	 * init of a new pid namespace.
	 * recreate the process tree

	while (1) {
		pid = next_pid_from_image();
		if (!pid)
			/* no more children */

		pid = clone(CLONE_CHILD_USEPIDS, &pid);
		if (pid == 0)
			goto restore_children;

	 * the process tree is recreated, can proceed with restoring
	 * other stuff

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds