Re: [PATCH v2 2/5] clone: add CLONE_PIDFD

From
Oleg Nesterov <oleg@redhat.com>
Date
2019-04-18 13:12:21
Also in
lkml
Reply to
Christian Brauner, 2019-04-18
On 04/18, Christian Brauner wrote:
quoted hunk ↗ jump to hunk
@@ -1674,13 +1729,14 @@ static __latent_entropy struct task_struct *copy_process(
 					unsigned long clone_flags,
 					unsigned long stack_start,
 					unsigned long stack_size,
+					int __user *parent_tidptr,
 					int __user *child_tidptr,
 					struct pid *pid,
 					int trace,
 					unsigned long tls,
 					int node)
 {
-	int retval;
+	int pidfd = -1, retval;
it seems that initialization is unneeded, but this is cosmetic.

I see no technical problems, feel free to add my reviewed-by.


But let me ask a couple of questions...


Why O_CLOEXEC? I am just curious, I do not really care.


Should we allow CLONE_THREAD | CLONE_PIDFD ?


Are you sure we will never need to extend this interface? If not, then perhaps it
make sense to add something like

	if (CLONE_PIDFD) {
		unsigned long not_used_yet;
		if (get_user(not_used_yet, parent_tidptr) ||
		    not_used_yet != 0)
			return -EINVAL;
	}

this way we can easily add more arguments in future or even turn CLONE_PIDFD into
CLONE_MORE_ARGS_IN_PARENT_TIDPTR.

Not that I think this is really good idea, sys_clone2() makes more sense, but still.

Oleg.
Thread (16 messages) 16 messages, 4 authors, last reply 2019-04-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help