From 0ddeeca25ce33686262459e2387f57bd09574e47 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 7 Mar 2008 02:37:41 +0800 Subject: [PATCH] [Blackfin] arch: add missing __user marking to ss_sp member of signalstack and a few userspace system functions Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- arch/blackfin/kernel/process.c | 20 +++++++++++--------- arch/blackfin/kernel/ptrace.c | 7 ++++--- arch/blackfin/kernel/signal.c | 4 ++-- arch/blackfin/kernel/sys_bfin.c | 2 +- arch/blackfin/kernel/traps.c | 2 +- include/asm-blackfin/signal.h | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index 6dedb2da8b..fb94cbeafa 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c @@ -202,7 +202,7 @@ copy_thread(int nr, unsigned long clone_flags, * sys_execve() executes a new program. */ -asmlinkage int sys_execve(char *name, char **argv, char **envp) +asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { int error; char *filename; @@ -245,23 +245,25 @@ unsigned long get_wchan(struct task_struct *p) void finish_atomic_sections (struct pt_regs *regs) { + int __user *up0 = (int __user *)®s->p0; + if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END) return; switch (regs->pc) { case ATOMIC_XCHG32 + 2: - put_user(regs->r1, (int *)regs->p0); + put_user(regs->r1, up0); regs->pc += 2; break; case ATOMIC_CAS32 + 2: case ATOMIC_CAS32 + 4: if (regs->r0 == regs->r1) - put_user(regs->r2, (int *)regs->p0); + put_user(regs->r2, up0); regs->pc = ATOMIC_CAS32 + 8; break; case ATOMIC_CAS32 + 6: - put_user(regs->r2, (int *)regs->p0); + put_user(regs->r2, up0); regs->pc += 2; break; @@ -269,7 +271,7 @@ void finish_atomic_sections (struct pt_regs *regs) regs->r0 = regs->r1 + regs->r0; /* fall through */ case ATOMIC_ADD32 + 4: - put_user(regs->r0, (int *)regs->p0); + put_user(regs->r0, up0); regs->pc = ATOMIC_ADD32 + 6; break; @@ -277,7 +279,7 @@ void finish_atomic_sections (struct pt_regs *regs) regs->r0 = regs->r1 - regs->r0; /* fall through */ case ATOMIC_SUB32 + 4: - put_user(regs->r0, (int *)regs->p0); + put_user(regs->r0, up0); regs->pc = ATOMIC_SUB32 + 6; break; @@ -285,7 +287,7 @@ void finish_atomic_sections (struct pt_regs *regs) regs->r0 = regs->r1 | regs->r0; /* fall through */ case ATOMIC_IOR32 + 4: - put_user(regs->r0, (int *)regs->p0); + put_user(regs->r0, up0); regs->pc = ATOMIC_IOR32 + 6; break; @@ -293,7 +295,7 @@ void finish_atomic_sections (struct pt_regs *regs) regs->r0 = regs->r1 & regs->r0; /* fall through */ case ATOMIC_AND32 + 4: - put_user(regs->r0, (int *)regs->p0); + put_user(regs->r0, up0); regs->pc = ATOMIC_AND32 + 6; break; @@ -301,7 +303,7 @@ void finish_atomic_sections (struct pt_regs *regs) regs->r0 = regs->r1 ^ regs->r0; /* fall through */ case ATOMIC_XOR32 + 4: - put_user(regs->r0, (int *)regs->p0); + put_user(regs->r0, up0); regs->pc = ATOMIC_XOR32 + 6; break; } diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 85caf9b711..b4f062c172 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c @@ -193,6 +193,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) { int ret; int add = 0; + unsigned long __user *datap = (unsigned long __user *)data; switch (request) { /* when I and D space are separate, these will need to be fixed. */ @@ -229,7 +230,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) pr_debug("ptrace: copied size %d [0x%08lx]\n", copied, tmp); if (copied != sizeof(tmp)) break; - ret = put_user(tmp, (unsigned long *)data); + ret = put_user(tmp, datap); break; } @@ -263,7 +264,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) } else { tmp = get_reg(child, addr); } - ret = put_user(tmp, (unsigned long *)data); + ret = put_user(tmp, datap); break; } @@ -389,7 +390,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) { /* Get all gp regs from the child. */ - ret = ptrace_getregs(child, (void __user *)data); + ret = ptrace_getregs(child, datap); break; } diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 5564c9588a..71cfcd28b3 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c @@ -55,13 +55,13 @@ struct rt_sigframe { struct ucontext uc; }; -asmlinkage int sys_sigaltstack(const stack_t * uss, stack_t * uoss) +asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) { return do_sigaltstack(uss, uoss, rdusp()); } static inline int -rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *pr0) +rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *pr0) { unsigned long usp = 0; int err = 0; diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c index abcd14817d..efb7b25a26 100644 --- a/arch/blackfin/kernel/sys_bfin.c +++ b/arch/blackfin/kernel/sys_bfin.c @@ -49,7 +49,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way unix traditionally does this, though. */ -asmlinkage int sys_pipe(unsigned long *fildes) +asmlinkage int sys_pipe(unsigned long __user *fildes) { int fd[2]; int error; diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 56a67ab698..e8e8f735c2 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c @@ -506,7 +506,7 @@ asmlinkage void trap_c(struct pt_regs *fp) info.si_signo = sig; info.si_errno = 0; - info.si_addr = (void *)fp->pc; + info.si_addr = (void __user *)fp->pc; force_sig_info(sig, &info, current); trace_buffer_restore(j); diff --git a/include/asm-blackfin/signal.h b/include/asm-blackfin/signal.h index 0250429b73..87951d2514 100644 --- a/include/asm-blackfin/signal.h +++ b/include/asm-blackfin/signal.h @@ -143,7 +143,7 @@ struct sigaction { #endif /* __KERNEL__ */ typedef struct sigaltstack { - void *ss_sp; + void __user *ss_sp; int ss_flags; size_t ss_size; } stack_t; -- 2.39.5