[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EC4F2FB.408@parallels.com>
Date: Thu, 17 Nov 2011 15:41:47 +0400
From: Pavel Emelyanov <xemul@...allels.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alan Cox <alan@...ux.intel.com>,
Roland McGrath <roland@...k.frob.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
CC: Tejun Heo <tj@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
James Bottomley <jbottomley@...allels.com>
Subject: [RFC][PATCH 0/3] fork: Add the ability to create tasks with given
pids
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
*/
restore_children:
while (1) {
pid = next_pid_from_image();
if (!pid)
/* no more children */
break;
pid = clone(CLONE_CHILD_USEPIDS, &pid);
if (pid == 0)
goto restore_children;
}
/*
* the process tree is recreated, can proceed with restoring
* other stuff
*/
Thanks,
Pavel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists