aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/signal_32.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-02-01 05:28:09 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-02-08 01:03:46 -0500
commit29e646df7829e41a6b0db32fd50ae6376640cd13 (patch)
tree4a1bcfdc58034417e9e8b0cbc3a96b1556e36706 /arch/powerpc/kernel/signal_32.c
parent5b1a43d7df65689b4c3b5a1c5c8158f1d4f74fbd (diff)
[PATCH] powerpc signal __user annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/powerpc/kernel/signal_32.c')
-rw-r--r--arch/powerpc/kernel/signal_32.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index c6d0595da6b5..bd837b5dbf06 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -142,11 +142,7 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
142 return 0; 142 return 0;
143} 143}
144 144
145static inline compat_uptr_t to_user_ptr(void *kp) 145#define to_user_ptr(p) ptr_to_compat(p)
146{
147 return (compat_uptr_t)(u64)kp;
148}
149
150#define from_user_ptr(p) compat_ptr(p) 146#define from_user_ptr(p) compat_ptr(p)
151 147
152static inline int save_general_regs(struct pt_regs *regs, 148static inline int save_general_regs(struct pt_regs *regs,
@@ -213,8 +209,8 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
213 return 0; 209 return 0;
214} 210}
215 211
216#define to_user_ptr(p) (p) 212#define to_user_ptr(p) ((unsigned long)(p))
217#define from_user_ptr(p) (p) 213#define from_user_ptr(p) ((void __user *)(p))
218 214
219static inline int save_general_regs(struct pt_regs *regs, 215static inline int save_general_regs(struct pt_regs *regs,
220 struct mcontext __user *frame) 216 struct mcontext __user *frame)
@@ -526,7 +522,7 @@ long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
526 522
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 523 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528 if (!ret && oact) { 524 if (!ret && oact) {
529 ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 525 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 526 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 527 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
532 } 528 }
@@ -675,8 +671,8 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 671int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
676 int r6, int r7, int r8, struct pt_regs *regs) 672 int r6, int r7, int r8, struct pt_regs *regs)
677{ 673{
678 stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 674 stack_32_t __user * newstack = compat_ptr(__new);
679 stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 675 stack_32_t __user * oldstack = compat_ptr(__old);
680 stack_t uss, uoss; 676 stack_t uss, uoss;
681 int ret; 677 int ret;
682 mm_segment_t old_fs; 678 mm_segment_t old_fs;
@@ -708,7 +704,7 @@ int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
708 set_fs(old_fs); 704 set_fs(old_fs);
709 /* Copy the stack information to the user output buffer */ 705 /* Copy the stack information to the user output buffer */
710 if (!ret && oldstack && 706 if (!ret && oldstack &&
711 (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 707 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 708 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
713 __put_user(uoss.ss_size, &oldstack->ss_size))) 709 __put_user(uoss.ss_size, &oldstack->ss_size)))
714 return -EFAULT; 710 return -EFAULT;