aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-21 15:56:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 22:36:33 -0500
commit9ac08002130b591d0f2ee035aa9062f84f2f15cb (patch)
tree35262e61fafefd6279eb39b2b45c4de5ee2166a2 /arch/arm64/kernel
parentb9763ce33fff6b37e1f2e2effb14fb25e67a68f2 (diff)
arm64: sanitize copy_thread(), switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r--arch/arm64/kernel/process.c8
-rw-r--r--arch/arm64/kernel/sys.c11
-rw-r--r--arch/arm64/kernel/sys_compat.c11
3 files changed, 4 insertions, 26 deletions
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");
235 235
236int copy_thread(unsigned long clone_flags, unsigned long stack_start, 236int copy_thread(unsigned long clone_flags, unsigned long stack_start,
237 unsigned long stk_sz, struct task_struct *p, 237 unsigned long stk_sz, struct task_struct *p,
238 struct pt_regs *regs) 238 struct pt_regs *unused)
239{ 239{
240 struct pt_regs *childregs = task_pt_regs(p); 240 struct pt_regs *childregs = task_pt_regs(p);
241 unsigned long tls = p->thread.tp_value; 241 unsigned long tls = p->thread.tp_value;
242 242
243 memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); 243 memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
244 244
245 if (likely(regs)) { 245 if (likely(!(p->flags & PF_KTHREAD))) {
246 *childregs = *regs; 246 *childregs = *current_pt_regs();
247 childregs->regs[0] = 0; 247 childregs->regs[0] = 0;
248 if (is_compat_thread(task_thread_info(p))) { 248 if (is_compat_thread(task_thread_info(p))) {
249 if (stack_start) 249 if (stack_start)
@@ -266,7 +266,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
266 * for the new thread. 266 * for the new thread.
267 */ 267 */
268 if (clone_flags & CLONE_SETTLS) 268 if (clone_flags & CLONE_SETTLS)
269 tls = regs->regs[3]; 269 tls = childregs->regs[3];
270 } else { 270 } else {
271 memset(childregs, 0, sizeof(struct pt_regs)); 271 memset(childregs, 0, sizeof(struct pt_regs));
272 childregs->pstate = PSR_MODE_EL1h; 272 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 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/syscalls.h> 27#include <linux/syscalls.h>
28 28
29/*
30 * Clone a task - this clones the calling program thread.
31 */
32asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
33 int __user *parent_tidptr, unsigned long tls_val,
34 int __user *child_tidptr)
35{
36 return do_fork(clone_flags, newsp, current_pt_regs(), 0,
37 parent_tidptr, child_tidptr);
38}
39
40asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 29asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
41 unsigned long prot, unsigned long flags, 30 unsigned long prot, unsigned long flags,
42 unsigned long fd, off_t off) 31 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 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd32.h> 29#include <asm/unistd32.h>
30 30
31asmlinkage int compat_sys_fork(void)
32{
33 return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL);
34}
35
36asmlinkage int compat_sys_vfork(void)
37{
38 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
39 current_pt_regs(), 0, NULL, NULL);
40}
41
42asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, 31asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid,
43 struct compat_timespec __user *interval) 32 struct compat_timespec __user *interval)
44{ 33{