aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-21 16:37:49 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 23:43:39 -0500
commit951b39619a76643972f6f23e007fd0f3fbbd71c2 (patch)
tree731800f22816f82bcc006de111d92baeb2805c3b /arch
parent24465a40ba452bd81fdc9eecb2d75bb903aafdf6 (diff)
c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/c6x/include/asm/syscalls.h4
-rw-r--r--arch/c6x/include/uapi/asm/unistd.h1
-rw-r--r--arch/c6x/kernel/entry.S12
-rw-r--r--arch/c6x/kernel/process.c25
4 files changed, 6 insertions, 36 deletions
diff --git a/arch/c6x/include/asm/syscalls.h b/arch/c6x/include/asm/syscalls.h
index e7b8991dc07c..df3d05feb153 100644
--- a/arch/c6x/include/asm/syscalls.h
+++ b/arch/c6x/include/asm/syscalls.h
@@ -41,10 +41,6 @@ extern long sys_fallocate_c6x(int fd, int mode,
41 u32 len_lo, u32 len_hi); 41 u32 len_lo, u32 len_hi);
42extern int sys_cache_sync(unsigned long s, unsigned long e); 42extern int sys_cache_sync(unsigned long s, unsigned long e);
43 43
44struct pt_regs;
45
46extern asmlinkage long sys_c6x_clone(struct pt_regs *regs);
47
48#include <asm-generic/syscalls.h> 44#include <asm-generic/syscalls.h>
49 45
50#endif /* __ASM_C6X_SYSCALLS_H */ 46#endif /* __ASM_C6X_SYSCALLS_H */
diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
index 625beafb9cd1..f3987a8703d9 100644
--- a/arch/c6x/include/uapi/asm/unistd.h
+++ b/arch/c6x/include/uapi/asm/unistd.h
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#define __ARCH_WANT_SYS_EXECVE 17#define __ARCH_WANT_SYS_EXECVE
18#define __ARCH_WANT_SYS_CLONE
18 19
19/* Use the standard ABI for syscalls. */ 20/* Use the standard ABI for syscalls. */
20#include <asm-generic/unistd.h> 21#include <asm-generic/unistd.h>
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S
index 75f6f36472cf..1037b98953ca 100644
--- a/arch/c6x/kernel/entry.S
+++ b/arch/c6x/kernel/entry.S
@@ -613,18 +613,6 @@ ENDPROC(sys_sigaltstack)
613 ;; Special system calls 613 ;; Special system calls
614 ;; return address is in B3 614 ;; return address is in B3
615 ;; 615 ;;
616ENTRY(sys_clone)
617 ADD .D1X SP,8,A4
618#ifdef CONFIG_C6X_BIG_KERNEL
619 || MVKL .S1 sys_c6x_clone,A0
620 MVKH .S1 sys_c6x_clone,A0
621 BNOP .S2X A0,5
622#else
623 || B .S2 sys_c6x_clone
624 NOP 5
625#endif
626ENDPROC(sys_clone)
627
628ENTRY(sys_rt_sigreturn) 616ENTRY(sys_rt_sigreturn)
629 ADD .D1X SP,8,A4 617 ADD .D1X SP,8,A4
630#ifdef CONFIG_C6X_BIG_KERNEL 618#ifdef CONFIG_C6X_BIG_KERNEL
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 2770d9a9a84e..a3f91895e8b4 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -112,22 +112,6 @@ void exit_thread(void)
112{ 112{
113} 113}
114 114
115SYSCALL_DEFINE1(c6x_clone, struct pt_regs *, regs)
116{
117 unsigned long clone_flags;
118 unsigned long newsp;
119
120 /* syscall puts clone_flags in A4 and usp in B4 */
121 clone_flags = regs->orig_a4;
122 if (regs->b4)
123 newsp = regs->b4;
124 else
125 newsp = regs->sp;
126
127 return do_fork(clone_flags, newsp, regs, 0, (int __user *)regs->a6,
128 (int __user *)regs->b6);
129}
130
131/* 115/*
132 * Do necessary setup to start up a newly executed thread. 116 * Do necessary setup to start up a newly executed thread.
133 */ 117 */
@@ -155,13 +139,13 @@ void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp)
155 */ 139 */
156int copy_thread(unsigned long clone_flags, unsigned long usp, 140int copy_thread(unsigned long clone_flags, unsigned long usp,
157 unsigned long ustk_size, 141 unsigned long ustk_size,
158 struct task_struct *p, struct pt_regs *regs) 142 struct task_struct *p, struct pt_regs *unused)
159{ 143{
160 struct pt_regs *childregs; 144 struct pt_regs *childregs;
161 145
162 childregs = task_pt_regs(p); 146 childregs = task_pt_regs(p);
163 147
164 if (!regs) { 148 if (unlikely(p->flags & PF_KTHREAD)) {
165 /* case of __kernel_thread: we return to supervisor space */ 149 /* case of __kernel_thread: we return to supervisor space */
166 memset(childregs, 0, sizeof(struct pt_regs)); 150 memset(childregs, 0, sizeof(struct pt_regs));
167 childregs->sp = (unsigned long)(childregs + 1); 151 childregs->sp = (unsigned long)(childregs + 1);
@@ -170,8 +154,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
170 childregs->a1 = ustk_size; /* argument */ 154 childregs->a1 = ustk_size; /* argument */
171 } else { 155 } else {
172 /* Otherwise use the given stack */ 156 /* Otherwise use the given stack */
173 *childregs = *regs; 157 *childregs = *current_pt_regs();
174 childregs->sp = usp; 158 if (usp)
159 childregs->sp = usp;
175 p->thread.pc = (unsigned long) ret_from_fork; 160 p->thread.pc = (unsigned long) ret_from_fork;
176 } 161 }
177 162