Sukadev Bhattiprolu wrote: > From: Sukadev Bhattiprolu <suka@suka.(none)> > Date: Tue, 20 Oct 2009 22:04:57 -0700 > Subject: [v10][PATCH 8/9] Define clone_with_pids() syscall [...] > diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c > index 4cf7956..41081eb 100644 > --- a/arch/x86/kernel/process_32.c > +++ b/arch/x86/kernel/process_32.c > @@ -445,6 +445,69 @@ int sys_clone(struct pt_regs *regs) > return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr); > } > > +int sys_clone_with_pids(struct pt_regs *regs) > +{ > + int rc; > + struct clone_args kcs; > + unsigned long flags; > + int __user *parent_tid_ptr; > + int __user *child_tid_ptr; > + unsigned long __user child_stack; > + unsigned long stack_size; > + unsigned int flags_low; > + struct clone_args __user *ucs; > + pid_t __user *pids; > + > + flags_low = regs->bx; > + ucs = (int __user *)regs->cx; > + pids = (int __user *)regs->dx; > + > + rc = copy_from_user(&kcs, ucs, sizeof(kcs)); > + if (rc) > + return -EFAULT; > + > + /* > + * TODO: If size of clone_args is not what the kernel expects, it > + * could be that kernel is newer and has an extended structure. > + * When that happens, this check needs to be smarter (and we > + * need an additional copy_from_user()). For now, assume exact > + * match. > + */ > + if (kcs.clone_args_size != sizeof(kcs)) > + return -EINVAL; I wonder if this is a reason to move the clone_args_size outside the structure and pass it as a regular argument ? This will rid the (futuristic) additional copy-from-user (in case it causes a concern for clone performance ?) Oren. _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers