[Devel] Re: [RFC][v7][PATCH 8/9]: Define clone2() syscall
Louis Rilling
Louis.Rilling at kerlabs.com
Fri Sep 25 01:23:47 PDT 2009
On Thu, Sep 24, 2009 at 11:43:59PM +0200, Arnd Bergmann wrote:
> On Thursday 24 September 2009, Sukadev Bhattiprolu wrote:
> > +asmlinkage long
> > +sys_clone2(struct clone_struct __user *ucs, pid_t __user *pids)
> > +{
> > + int rc;
> > + struct clone_struct kcs;
> > + unsigned long clone_flags;
> > + int __user *parent_tid_ptr;
> > + int __user *child_tid_ptr;
> > + unsigned long __user child_stack_base;
> > + struct pt_regs *regs;
> > +
> > + rc = copy_from_user(&ucs, &kcs, sizeof(kcs));
> > + if (rc)
> > + return -EFAULT;
> > +
> > + /*
> > + * TODO: Convert clone_flags to 64-bit
> > + */
> > + clone_flags = (unsigned long)kcs.flags;
> > + child_stack_base = (unsigned long)kcs.child_stack;
> > + parent_tid_ptr = &ucs.parent_tid;
> > + child_tid_ptr = &ucs.child_tid;
> > + regs = task_pt_regs(current);
> > +
> > + if (!child_stack_base)
> > + child_stack_base = user_stack_pointer(regs);
> > +
> > + return do_fork_with_pids(clone_flags, child_stack_base, regs, 0,
> > + parent_tid_ptr, child_tid_ptr, kcs.nr_pids, pids);
> > +}
> > +
>
> The function looks ok, but you have put it into arch/x86/kernel/process_32.c,
> which is specific to x86-32. Since the code in this form is generic, why
> not just put it into kernel/fork.c? You should probably enclose it within
> #ifdef CONFIG_HAVE_ARCH_TRACEHOOK to make sure that user_stack_pointer()
> is implemented, but then it would be immediately usable by the nine architectures
> implementing that. The other architectures can then decide between adding
> their private version of sys_clone2 with an open-coded user_stack_pointer
> implementation or alternatively implement the tracehooks.
It will very likely break ia64, which defines CONFIG_HAVE_ARCH_TRACEHOOK and
already has sys_clone2().
Louis
--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.openvz.org/pipermail/devel/attachments/20090925/7291902f/attachment-0001.sig>
-------------- next part --------------
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list