From ddf23e87a804cbf6fa3818076b33fe023cce09fd Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 11 Oct 2012 17:32:41 -0400 Subject: mn10300: switch to saner kernel_execve() semantics Signed-off-by: Al Viro --- arch/mn10300/Kconfig | 1 + arch/mn10300/include/asm/unistd.h | 1 - arch/mn10300/kernel/entry.S | 7 +------ 3 files changed, 2 insertions(+), 7 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 04669fac117b..72471744a912 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig @@ -9,6 +9,7 @@ config MN10300 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER select GENERIC_CLOCKEVENTS select GENERIC_KERNEL_THREAD + select GENERIC_KERNEL_EXECVE select MODULES_USE_ELF_RELA config AM33_2 diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 55bbec1887e9..9711d51b0212 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h @@ -44,7 +44,6 @@ #define __ARCH_WANT_SYS_RT_SIGACTION #define __ARCH_WANT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_EXECVE -#define __ARCH_WANT_KERNEL_EXECVE /* * "Conditional" syscalls diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S index 0c631d34c8d7..68fcab8f8f6f 100644 --- a/arch/mn10300/kernel/entry.S +++ b/arch/mn10300/kernel/entry.S @@ -60,13 +60,8 @@ ENTRY(ret_from_kernel_thread) mov (REG_D0,fp),d0 mov (REG_A0,fp),a0 calls (a0) - jmp sys_exit - -ENTRY(ret_from_kernel_execve) - add -12,d0 /* pt_regs -> frame */ - mov d0,sp - GET_THREAD_INFO a2 clr d0 + mov d0,(REG_D0,fp) jmp syscall_exit ############################################################################### -- cgit v1.2.2 From 1ea2a0160588582cd8414a8026d5b54f1705dfa1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 21 Oct 2012 16:43:13 -0400 Subject: mn10300: switch to generic fork/vfork/clone Signed-off-by: Al Viro --- arch/mn10300/include/asm/unistd.h | 3 +++ arch/mn10300/kernel/process.c | 33 +++++---------------------------- 2 files changed, 8 insertions(+), 28 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 9711d51b0212..cabf8ba73b27 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h @@ -44,6 +44,9 @@ #define __ARCH_WANT_SYS_RT_SIGACTION #define __ARCH_WANT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_EXECVE +#define __ARCH_WANT_SYS_FORK +#define __ARCH_WANT_SYS_VFORK +#define __ARCH_WANT_SYS_CLONE /* * "Conditional" syscalls diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index d0c671b6d9ff..5e0ef396458d 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c @@ -206,7 +206,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) */ int copy_thread(unsigned long clone_flags, unsigned long c_usp, unsigned long ustk_size, - struct task_struct *p, struct pt_regs *kregs) + struct task_struct *p, struct pt_regs *unused) { struct thread_info *ti = task_thread_info(p); struct pt_regs *c_regs; @@ -227,7 +227,7 @@ int copy_thread(unsigned long clone_flags, p->thread.wchan = p->thread.pc; p->thread.usp = c_usp; - if (unlikely(!kregs)) { + if (unlikely(p->flags & PF_KTHREAD)) { memset(c_regs, 0, sizeof(struct pt_regs)); c_regs->a0 = c_usp; /* function */ c_regs->d0 = ustk_size; /* argument */ @@ -236,8 +236,9 @@ int copy_thread(unsigned long clone_flags, p->thread.pc = (unsigned long) ret_from_kernel_thread; return 0; } - *c_regs = *kregs; - c_regs->sp = c_usp; + *c_regs = *current_pt_regs(); + if (c_usp) + c_regs->sp = c_usp; c_regs->epsw &= ~EPSW_FE; /* my FPU */ /* the new TLS pointer is passed in as arg #5 to sys_clone() */ @@ -249,30 +250,6 @@ int copy_thread(unsigned long clone_flags, return 0; } -/* - * clone a process - * - tlsptr is retrieved by copy_thread() from current_frame()->d3 - */ -asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, - int __user *parent_tidptr, int __user *child_tidptr, - int __user *tlsptr) -{ - return do_fork(clone_flags, newsp ?: current_frame()->sp, - current_frame(), 0, parent_tidptr, child_tidptr); -} - -asmlinkage long sys_fork(void) -{ - return do_fork(SIGCHLD, current_frame()->sp, - current_frame(), 0, NULL, NULL); -} - -asmlinkage long sys_vfork(void) -{ - return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, current_frame()->sp, - current_frame(), 0, NULL, NULL); -} - unsigned long get_wchan(struct task_struct *p) { return p->thread.wchan; -- cgit v1.2.2 From afa86fc426ff7e7f5477f15da9c405d08d5cf790 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 22 Oct 2012 22:51:14 -0400 Subject: flagday: don't pass regs to copy_thread() Signed-off-by: Al Viro --- arch/mn10300/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 5e0ef396458d..eb09f5a552ff 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c @@ -206,7 +206,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) */ int copy_thread(unsigned long clone_flags, unsigned long c_usp, unsigned long ustk_size, - struct task_struct *p, struct pt_regs *unused) + struct task_struct *p) { struct thread_info *ti = task_thread_info(p); struct pt_regs *c_regs; -- cgit v1.2.2 From 4f4202fe5ae9a43e59303f20d700571f695d7b1b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 5 Nov 2012 12:59:15 -0500 Subject: unify default ptrace_signal_deliver Signed-off-by: Al Viro --- arch/mn10300/include/asm/signal.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h index f9668ec3040c..d280e9780793 100644 --- a/arch/mn10300/include/asm/signal.h +++ b/arch/mn10300/include/asm/signal.h @@ -45,8 +45,4 @@ struct k_sigaction { }; #include - -struct pt_regs; -#define ptrace_signal_deliver(regs, cookie) do { } while (0) - #endif /* _ASM_SIGNAL_H */ -- cgit v1.2.2