From 733deca197143857f938b41d671cd7ce9c53c4bc Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Oct 2012 13:13:11 -0400 Subject: Drop struct pt_regs * argument in compat_sys_execve() Signed-off-by: Al Viro --- arch/tile/include/asm/compat.h | 6 ------ arch/tile/include/asm/processor.h | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 3063e6fc8daa..3bcf1b94b563 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -275,9 +275,6 @@ extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka, struct compat_sigaction; struct compat_siginfo; struct compat_sigaltstack; -long compat_sys_execve(const char __user *path, - compat_uptr_t __user *argv, - compat_uptr_t __user *envp, struct pt_regs *); long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, struct compat_sigaction __user *oact, size_t sigsetsize); @@ -304,9 +301,6 @@ long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval); /* These are the intvec_64.S trampolines. */ -long _compat_sys_execve(const char __user *path, - const compat_uptr_t __user *argv, - const compat_uptr_t __user *envp); long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, struct compat_sigaltstack __user *uoss_ptr); long _compat_sys_rt_sigreturn(void); diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h index 8c4dd9ff91eb..9a83e531e843 100644 --- a/arch/tile/include/asm/processor.h +++ b/arch/tile/include/asm/processor.h @@ -239,6 +239,9 @@ unsigned long get_wchan(struct task_struct *p); #define KSTK_TOP(task) (task_ksp0(task) - STACK_TOP_DELTA) #define task_pt_regs(task) \ ((struct pt_regs *)(task_ksp0(task) - KSTK_PTREGS_GAP) - 1) +#define current_pt_regs() \ + ((struct pt_regs *)((stack_pointer | (THREAD_SIZE - 1)) - \ + (KSTK_PTREGS_GAP - 1)) - 1) #define task_sp(task) (task_pt_regs(task)->sp) #define task_pc(task) (task_pt_regs(task)->pc) /* Aliases for pc and sp (used in fs/proc/array.c) */ -- cgit v1.2.2 From 0f8b983812f5ff588d7e3459b203714e4e58a9b2 Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Fri, 19 Oct 2012 16:25:12 -0400 Subject: tile: support GENERIC_KERNEL_THREAD and GENERIC_KERNEL_EXECVE Also provide an optimized current_pt_regs() while we're at it. Signed-off-by: Chris Metcalf Signed-off-by: Al Viro --- arch/tile/include/asm/switch_to.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/switch_to.h b/arch/tile/include/asm/switch_to.h index 1d48c5fee8b7..b8f888cbe6b0 100644 --- a/arch/tile/include/asm/switch_to.h +++ b/arch/tile/include/asm/switch_to.h @@ -68,7 +68,10 @@ extern unsigned long get_switch_to_pc(void); /* Support function for forking a new task. */ void ret_from_fork(void); -/* Called from ret_from_fork() when a new process starts up. */ +/* Support function for forking a new kernel thread. */ +void ret_from_kernel_thread(void *fn, void *arg); + +/* Called from ret_from_xxx() when a new process starts up. */ struct task_struct *sim_notify_fork(struct task_struct *prev); #endif /* !__ASSEMBLY__ */ -- cgit v1.2.2 From 530550651fdfd548d25b6bd5ff4607803540508b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Oct 2012 13:14:08 -0400 Subject: tile: switch to generic sys_execve() Acked-by: Chris Metcalf Signed-off-by: Al Viro --- arch/tile/include/asm/elf.h | 1 + arch/tile/include/asm/processor.h | 1 + arch/tile/include/asm/syscalls.h | 3 ++- arch/tile/include/asm/unistd.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h index f8ccf08f6934..b73e1039c911 100644 --- a/arch/tile/include/asm/elf.h +++ b/arch/tile/include/asm/elf.h @@ -148,6 +148,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, #define compat_start_thread(regs, ip, usp) do { \ regs->pc = ptr_to_compat_reg((void *)(ip)); \ regs->sp = ptr_to_compat_reg((void *)(usp)); \ + single_step_execve(); \ } while (0) /* diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h index 9a83e531e843..879073e76586 100644 --- a/arch/tile/include/asm/processor.h +++ b/arch/tile/include/asm/processor.h @@ -211,6 +211,7 @@ static inline void start_thread(struct pt_regs *regs, { regs->pc = pc; regs->sp = usp; + single_step_execve(); } /* Free all resources held by a thread. */ diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h index 06f0464cfed9..0d52992f8e05 100644 --- a/arch/tile/include/asm/syscalls.h +++ b/arch/tile/include/asm/syscalls.h @@ -68,9 +68,10 @@ long _sys_sigaltstack(const stack_t __user *, stack_t __user *); long _sys_rt_sigreturn(void); long _sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid); -long _sys_execve(const char __user *filename, +long sys_execve(const char __user *filename, const char __user *const __user *argv, const char __user *const __user *envp); +#define sys_execve sys_execve #include diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h index 6e032a0a268e..dab827dc8acb 100644 --- a/arch/tile/include/asm/unistd.h +++ b/arch/tile/include/asm/unistd.h @@ -16,4 +16,5 @@ #define __ARCH_WANT_SYS_LLSEEK #endif #define __ARCH_WANT_SYS_NEWFSTATAT +#define __ARCH_WANT_SYS_EXECVE #include -- cgit v1.2.2 From 6b14e4198c729b748a7f6d22059e6a101d2b241a Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Tue, 23 Oct 2012 13:30:54 -0400 Subject: arch/tile: eliminate pt_regs trampolines for syscalls Using the new current_pt_regs() model, we can remove some trampolines from assembly code and call directly to the C syscall implementations. rt_sigreturn() and clone() still need some assembly wrapping, but no longer are passed a pt_regs pointer. sigaltstack() and the tilepro-specific cmpxchg_badaddr() syscalls are now just straight C. Signed-off-by: Chris Metcalf --- arch/tile/include/asm/compat.h | 9 +++------ arch/tile/include/asm/syscalls.h | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 3bcf1b94b563..ca61fb4296b3 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -280,10 +280,9 @@ long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, size_t sigsetsize); long compat_sys_rt_sigqueueinfo(int pid, int sig, struct compat_siginfo __user *uinfo); -long compat_sys_rt_sigreturn(struct pt_regs *); +long compat_sys_rt_sigreturn(void); long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, - struct compat_sigaltstack __user *uoss_ptr, - struct pt_regs *); + struct compat_sigaltstack __user *uoss_ptr); long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, @@ -300,9 +299,7 @@ long compat_sys_fallocate(int fd, int mode, long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval); -/* These are the intvec_64.S trampolines. */ -long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, - struct compat_sigaltstack __user *uoss_ptr); +/* Assembly trampoline to avoid clobbering r0. */ long _compat_sys_rt_sigreturn(void); #endif /* _ASM_TILE_COMPAT_H */ diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h index 0d52992f8e05..369696d63e7b 100644 --- a/arch/tile/include/asm/syscalls.h +++ b/arch/tile/include/asm/syscalls.h @@ -51,8 +51,7 @@ long sys_cacheflush(unsigned long addr, unsigned long len, #ifndef __tilegx__ /* mm/fault.c */ -long sys_cmpxchg_badaddr(unsigned long address, struct pt_regs *); -long _sys_cmpxchg_badaddr(unsigned long address); +long sys_cmpxchg_badaddr(unsigned long address); #endif #ifdef CONFIG_COMPAT @@ -63,15 +62,23 @@ long sys_truncate64(const char __user *path, loff_t length); long sys_ftruncate64(unsigned int fd, loff_t length); #endif -/* These are the intvec*.S trampolines. */ -long _sys_sigaltstack(const stack_t __user *, stack_t __user *); -long _sys_rt_sigreturn(void); -long _sys_clone(unsigned long clone_flags, unsigned long newsp, +/* Provide versions of standard syscalls that use current_pt_regs(). */ +long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid); long sys_execve(const char __user *filename, const char __user *const __user *argv, const char __user *const __user *envp); +long sys_rt_sigreturn(void); +long sys_sigaltstack(const stack_t __user *, stack_t __user *); +#define sys_clone sys_clone #define sys_execve sys_execve +#define sys_rt_sigreturn sys_rt_sigreturn +#define sys_sigaltstack sys_sigaltstack + +/* These are the intvec*.S trampolines. */ +long _sys_rt_sigreturn(void); +long _sys_clone(unsigned long clone_flags, unsigned long newsp, + void __user *parent_tid, void __user *child_tid); #include -- cgit v1.2.2 From 6b94631f9e8c45a46056cbc6a7a50ecebea4f8da Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Oct 2012 13:32:30 -0400 Subject: consolidate sys_execve() prototype Signed-off-by: Al Viro --- arch/tile/include/asm/syscalls.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h index 369696d63e7b..394c76f2dc76 100644 --- a/arch/tile/include/asm/syscalls.h +++ b/arch/tile/include/asm/syscalls.h @@ -65,13 +65,9 @@ long sys_ftruncate64(unsigned int fd, loff_t length); /* Provide versions of standard syscalls that use current_pt_regs(). */ long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid); -long sys_execve(const char __user *filename, - const char __user *const __user *argv, - const char __user *const __user *envp); long sys_rt_sigreturn(void); long sys_sigaltstack(const stack_t __user *, stack_t __user *); #define sys_clone sys_clone -#define sys_execve sys_execve #define sys_rt_sigreturn sys_rt_sigreturn #define sys_sigaltstack sys_sigaltstack -- cgit v1.2.2 From 910cdc553a324d3df56b73c84cdef20836817d52 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Oct 2012 21:42:37 -0400 Subject: kill stray kernel_thread() garbage Signed-off-by: Al Viro --- arch/tile/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h index 879073e76586..2b70dfb1442e 100644 --- a/arch/tile/include/asm/processor.h +++ b/arch/tile/include/asm/processor.h @@ -220,8 +220,6 @@ static inline void release_thread(struct task_struct *dead_task) /* Nothing for now */ } -extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); - extern int do_work_pending(struct pt_regs *regs, u32 flags); -- cgit v1.2.2 From e9eac30418dbbe51217a7c91906d349f9f4658e1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 26 Oct 2012 23:36:42 -0400 Subject: tile: switch to generic clone() Signed-off-by: Al Viro --- arch/tile/include/asm/unistd.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h index dab827dc8acb..b51c6ee3cd6c 100644 --- a/arch/tile/include/asm/unistd.h +++ b/arch/tile/include/asm/unistd.h @@ -17,4 +17,5 @@ #endif #define __ARCH_WANT_SYS_NEWFSTATAT #define __ARCH_WANT_SYS_EXECVE +#define __ARCH_WANT_SYS_CLONE #include -- cgit v1.2.2 From 24465a40ba452bd81fdc9eecb2d75bb903aafdf6 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 28 Nov 2012 23:04:26 -0500 Subject: take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h now it can be done... Signed-off-by: Al Viro --- arch/tile/include/asm/syscalls.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch/tile/include') diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h index 394c76f2dc76..4c8462a62cb6 100644 --- a/arch/tile/include/asm/syscalls.h +++ b/arch/tile/include/asm/syscalls.h @@ -63,11 +63,8 @@ long sys_ftruncate64(unsigned int fd, loff_t length); #endif /* Provide versions of standard syscalls that use current_pt_regs(). */ -long sys_clone(unsigned long clone_flags, unsigned long newsp, - void __user *parent_tid, void __user *child_tid); long sys_rt_sigreturn(void); long sys_sigaltstack(const stack_t __user *, stack_t __user *); -#define sys_clone sys_clone #define sys_rt_sigreturn sys_rt_sigreturn #define sys_sigaltstack sys_sigaltstack -- cgit v1.2.2