lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200909242343.59903.arnd@arndb.de>
Date:	Thu, 24 Sep 2009 23:43:59 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, Oren Laadan <orenl@...columbia.edu>,
	serue@...ibm.com, "Eric W. Biederman" <ebiederm@...ssion.com>,
	Alexey Dobriyan <adobriyan@...il.com>,
	Pavel Emelyanov <xemul@...nvz.org>,
	Andrew Morton <akpm@...l.org>, torvalds@...ux-foundation.org,
	mikew@...gle.com, mingo@...e.hu, hpa@...or.com,
	Nathan Lynch <nathanl@...tin.ibm.com>, peterz@...radead.org,
	Containers <containers@...ts.linux-foundation.org>,
	sukadev@...ibm.com
Subject: Re: [RFC][v7][PATCH 8/9]: Define clone2() syscall

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.

	Arnd <><
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ