diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-21 21:57:32 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-29 04:36:45 +0100 |
commit | 584271bcb45b50027c8d87b51634750780c92437 (patch) | |
tree | ae0fa71904cfc2d3e7b876f4be03240556cd381a /arch/avr32/kernel/process.c | |
parent | arm64: sanitize copy_thread(), switch to generic fork/vfork/clone (diff) | |
download | linux-584271bcb45b50027c8d87b51634750780c92437.tar.xz linux-584271bcb45b50027c8d87b51634750780c92437.zip |
avr32: sanitize copy_thread(), switch to generic fork/vfork/clone, kill wrappers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/avr32/kernel/process.c')
-rw-r--r-- | arch/avr32/kernel/process.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index 09b894d96d6e..03d7aa4a4bc9 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c @@ -299,11 +299,11 @@ asmlinkage void syscall_return(void); int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg, - struct task_struct *p, struct pt_regs *regs) + struct task_struct *p, struct pt_regs *unused) { struct pt_regs *childregs = task_pt_regs(p); - if (unlikely(!regs)) { + if (unlikely(p->flags & PF_KTHREAD)) { memset(childregs, 0, sizeof(struct pt_regs)); p->thread.cpu_context.r0 = arg; p->thread.cpu_context.r1 = usp; /* fn */ @@ -311,8 +311,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread; childregs->sr = MODE_SUPERVISOR; } else { - *childregs = *regs; - childregs->sp = usp; + *childregs = *current_pt_regs(); + if (usp) + childregs->sp = usp; childregs->r12 = 0; /* Set return value for child */ p->thread.cpu_context.pc = (unsigned long)ret_from_fork; } @@ -327,28 +328,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, return 0; } -/* r12-r8 are dummy parameters to force the compiler to use the stack */ -asmlinkage int sys_fork(struct pt_regs *regs) -{ - return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL); -} - -asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, - void __user *parent_tidptr, void __user *child_tidptr, - struct pt_regs *regs) -{ - if (!newsp) - newsp = regs->sp; - return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, - child_tidptr); -} - -asmlinkage int sys_vfork(struct pt_regs *regs) -{ - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs, - 0, NULL, NULL); -} - /* * This function is supposed to answer the question "who called * schedule()?" |