From 9ac08002130b591d0f2ee035aa9062f84f2f15cb Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 21 Oct 2012 15:56:52 -0400 Subject: arm64: sanitize copy_thread(), switch to generic fork/vfork/clone Signed-off-by: Al Viro --- arch/arm64/kernel/process.c | 8 ++++---- arch/arm64/kernel/sys.c | 11 ----------- arch/arm64/kernel/sys_compat.c | 11 ----------- 3 files changed, 4 insertions(+), 26 deletions(-) (limited to 'arch/arm64/kernel') diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 8a5f3341861e..5a1335caf6f1 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -235,15 +235,15 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork"); int copy_thread(unsigned long clone_flags, unsigned long stack_start, unsigned long stk_sz, struct task_struct *p, - struct pt_regs *regs) + struct pt_regs *unused) { struct pt_regs *childregs = task_pt_regs(p); unsigned long tls = p->thread.tp_value; memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); - if (likely(regs)) { - *childregs = *regs; + if (likely(!(p->flags & PF_KTHREAD))) { + *childregs = *current_pt_regs(); childregs->regs[0] = 0; if (is_compat_thread(task_thread_info(p))) { if (stack_start) @@ -266,7 +266,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, * for the new thread. */ if (clone_flags & CLONE_SETTLS) - tls = regs->regs[3]; + tls = childregs->regs[3]; } else { memset(childregs, 0, sizeof(struct pt_regs)); childregs->pstate = PSR_MODE_EL1h; diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index 4364df85050e..8292a9b090f8 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c @@ -26,17 +26,6 @@ #include #include -/* - * Clone a task - this clones the calling program thread. - */ -asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, - int __user *parent_tidptr, unsigned long tls_val, - int __user *child_tidptr) -{ - return do_fork(clone_flags, newsp, current_pt_regs(), 0, - parent_tidptr, child_tidptr); -} - asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, off_t off) diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index 6fabc1912da0..f7b05edf8ce3 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c @@ -28,17 +28,6 @@ #include #include -asmlinkage int compat_sys_fork(void) -{ - return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL); -} - -asmlinkage int compat_sys_vfork(void) -{ - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, - current_pt_regs(), 0, NULL, NULL); -} - asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) { -- cgit v1.2.3