aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/signal.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2006-01-12 04:06:25 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 12:09:02 -0500
commit2382f77ffcde32e5195d5c82fee91171bb764c1a (patch)
treea63001b229c1a6f89459f8bfcba6a40950bd92eb /arch/m68k/kernel/signal.c
parent11c40f8a6ac8bd057043b1f9e7c9490c0e6149f3 (diff)
[PATCH] m68k: signal __user annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/m68k/kernel/signal.c')
-rw-r--r--arch/m68k/kernel/signal.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 9c636a4c238d..866917bfa028 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -96,7 +96,7 @@ asmlinkage int do_sigsuspend(struct pt_regs *regs)
96asmlinkage int 96asmlinkage int
97do_rt_sigsuspend(struct pt_regs *regs) 97do_rt_sigsuspend(struct pt_regs *regs)
98{ 98{
99 sigset_t *unewset = (sigset_t *)regs->d1; 99 sigset_t __user *unewset = (sigset_t __user *)regs->d1;
100 size_t sigsetsize = (size_t)regs->d2; 100 size_t sigsetsize = (size_t)regs->d2;
101 sigset_t saveset, newset; 101 sigset_t saveset, newset;
102 102
@@ -122,8 +122,8 @@ do_rt_sigsuspend(struct pt_regs *regs)
122} 122}
123 123
124asmlinkage int 124asmlinkage int
125sys_sigaction(int sig, const struct old_sigaction *act, 125sys_sigaction(int sig, const struct old_sigaction __user *act,
126 struct old_sigaction *oact) 126 struct old_sigaction __user *oact)
127{ 127{
128 struct k_sigaction new_ka, old_ka; 128 struct k_sigaction new_ka, old_ka;
129 int ret; 129 int ret;
@@ -154,7 +154,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
154} 154}
155 155
156asmlinkage int 156asmlinkage int
157sys_sigaltstack(const stack_t *uss, stack_t *uoss) 157sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
158{ 158{
159 return do_sigaltstack(uss, uoss, rdusp()); 159 return do_sigaltstack(uss, uoss, rdusp());
160} 160}
@@ -169,10 +169,10 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss)
169 169
170struct sigframe 170struct sigframe
171{ 171{
172 char *pretcode; 172 char __user *pretcode;
173 int sig; 173 int sig;
174 int code; 174 int code;
175 struct sigcontext *psc; 175 struct sigcontext __user *psc;
176 char retcode[8]; 176 char retcode[8];
177 unsigned long extramask[_NSIG_WORDS-1]; 177 unsigned long extramask[_NSIG_WORDS-1];
178 struct sigcontext sc; 178 struct sigcontext sc;
@@ -180,10 +180,10 @@ struct sigframe
180 180
181struct rt_sigframe 181struct rt_sigframe
182{ 182{
183 char *pretcode; 183 char __user *pretcode;
184 int sig; 184 int sig;
185 struct siginfo *pinfo; 185 struct siginfo __user *pinfo;
186 void *puc; 186 void __user *puc;
187 char retcode[8]; 187 char retcode[8];
188 struct siginfo info; 188 struct siginfo info;
189 struct ucontext uc; 189 struct ucontext uc;
@@ -248,7 +248,7 @@ out:
248#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4] 248#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
249#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1] 249#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
250 250
251static inline int rt_restore_fpu_state(struct ucontext *uc) 251static inline int rt_restore_fpu_state(struct ucontext __user *uc)
252{ 252{
253 unsigned char fpstate[FPCONTEXT_SIZE]; 253 unsigned char fpstate[FPCONTEXT_SIZE];
254 int context_size = CPU_IS_060 ? 8 : 0; 254 int context_size = CPU_IS_060 ? 8 : 0;
@@ -267,7 +267,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
267 return 0; 267 return 0;
268 } 268 }
269 269
270 if (__get_user(*(long *)fpstate, (long *)&uc->uc_fpstate)) 270 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
271 goto out; 271 goto out;
272 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { 272 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
273 if (!CPU_IS_060) 273 if (!CPU_IS_060)
@@ -306,7 +306,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
306 "m" (*fpregs.f_fpcntl)); 306 "m" (*fpregs.f_fpcntl));
307 } 307 }
308 if (context_size && 308 if (context_size &&
309 __copy_from_user(fpstate + 4, (long *)&uc->uc_fpstate + 1, 309 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
310 context_size)) 310 context_size))
311 goto out; 311 goto out;
312 __asm__ volatile (".chip 68k/68881\n\t" 312 __asm__ volatile (".chip 68k/68881\n\t"
@@ -319,7 +319,7 @@ out:
319} 319}
320 320
321static inline int 321static inline int
322restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp, 322restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp,
323 int *pd0) 323 int *pd0)
324{ 324{
325 int fsize, formatvec; 325 int fsize, formatvec;
@@ -404,10 +404,10 @@ badframe:
404 404
405static inline int 405static inline int
406rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw, 406rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
407 struct ucontext *uc, int *pd0) 407 struct ucontext __user *uc, int *pd0)
408{ 408{
409 int fsize, temp; 409 int fsize, temp;
410 greg_t *gregs = uc->uc_mcontext.gregs; 410 greg_t __user *gregs = uc->uc_mcontext.gregs;
411 unsigned long usp; 411 unsigned long usp;
412 int err; 412 int err;
413 413
@@ -506,7 +506,7 @@ asmlinkage int do_sigreturn(unsigned long __unused)
506 struct switch_stack *sw = (struct switch_stack *) &__unused; 506 struct switch_stack *sw = (struct switch_stack *) &__unused;
507 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 507 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
508 unsigned long usp = rdusp(); 508 unsigned long usp = rdusp();
509 struct sigframe *frame = (struct sigframe *)(usp - 4); 509 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
510 sigset_t set; 510 sigset_t set;
511 int d0; 511 int d0;
512 512
@@ -536,7 +536,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
536 struct switch_stack *sw = (struct switch_stack *) &__unused; 536 struct switch_stack *sw = (struct switch_stack *) &__unused;
537 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 537 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
538 unsigned long usp = rdusp(); 538 unsigned long usp = rdusp();
539 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 539 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
540 sigset_t set; 540 sigset_t set;
541 int d0; 541 int d0;
542 542
@@ -596,7 +596,7 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
596 } 596 }
597} 597}
598 598
599static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs) 599static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
600{ 600{
601 unsigned char fpstate[FPCONTEXT_SIZE]; 601 unsigned char fpstate[FPCONTEXT_SIZE];
602 int context_size = CPU_IS_060 ? 8 : 0; 602 int context_size = CPU_IS_060 ? 8 : 0;
@@ -617,7 +617,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
617 ".chip 68k" 617 ".chip 68k"
618 : : "m" (*fpstate) : "memory"); 618 : : "m" (*fpstate) : "memory");
619 619
620 err |= __put_user(*(long *)fpstate, (long *)&uc->uc_fpstate); 620 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
621 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { 621 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
622 fpregset_t fpregs; 622 fpregset_t fpregs;
623 if (!CPU_IS_060) 623 if (!CPU_IS_060)
@@ -642,7 +642,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
642 sizeof(fpregs)); 642 sizeof(fpregs));
643 } 643 }
644 if (context_size) 644 if (context_size)
645 err |= copy_to_user((long *)&uc->uc_fpstate + 1, fpstate + 4, 645 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
646 context_size); 646 context_size);
647 return err; 647 return err;
648} 648}
@@ -662,10 +662,10 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
662 save_fpu_state(sc, regs); 662 save_fpu_state(sc, regs);
663} 663}
664 664
665static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) 665static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
666{ 666{
667 struct switch_stack *sw = (struct switch_stack *)regs - 1; 667 struct switch_stack *sw = (struct switch_stack *)regs - 1;
668 greg_t *gregs = uc->uc_mcontext.gregs; 668 greg_t __user *gregs = uc->uc_mcontext.gregs;
669 int err = 0; 669 int err = 0;
670 670
671 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); 671 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
@@ -753,7 +753,7 @@ static inline void push_cache (unsigned long vaddr)
753 } 753 }
754} 754}
755 755
756static inline void * 756static inline void __user *
757get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 757get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
758{ 758{
759 unsigned long usp; 759 unsigned long usp;
@@ -766,13 +766,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
766 if (!on_sig_stack(usp)) 766 if (!on_sig_stack(usp))
767 usp = current->sas_ss_sp + current->sas_ss_size; 767 usp = current->sas_ss_sp + current->sas_ss_size;
768 } 768 }
769 return (void *)((usp - frame_size) & -8UL); 769 return (void __user *)((usp - frame_size) & -8UL);
770} 770}
771 771
772static void setup_frame (int sig, struct k_sigaction *ka, 772static void setup_frame (int sig, struct k_sigaction *ka,
773 sigset_t *set, struct pt_regs *regs) 773 sigset_t *set, struct pt_regs *regs)
774{ 774{
775 struct sigframe *frame; 775 struct sigframe __user *frame;
776 int fsize = frame_extra_sizes[regs->format]; 776 int fsize = frame_extra_sizes[regs->format];
777 struct sigcontext context; 777 struct sigcontext context;
778 int err = 0; 778 int err = 0;
@@ -813,7 +813,7 @@ static void setup_frame (int sig, struct k_sigaction *ka,
813 err |= __put_user(frame->retcode, &frame->pretcode); 813 err |= __put_user(frame->retcode, &frame->pretcode);
814 /* moveq #,d0; trap #0 */ 814 /* moveq #,d0; trap #0 */
815 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16), 815 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
816 (long *)(frame->retcode)); 816 (long __user *)(frame->retcode));
817 817
818 if (err) 818 if (err)
819 goto give_sigsegv; 819 goto give_sigsegv;
@@ -849,7 +849,7 @@ give_sigsegv:
849static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, 849static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
850 sigset_t *set, struct pt_regs *regs) 850 sigset_t *set, struct pt_regs *regs)
851{ 851{
852 struct rt_sigframe *frame; 852 struct rt_sigframe __user *frame;
853 int fsize = frame_extra_sizes[regs->format]; 853 int fsize = frame_extra_sizes[regs->format];
854 int err = 0; 854 int err = 0;
855 855
@@ -880,8 +880,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
880 880
881 /* Create the ucontext. */ 881 /* Create the ucontext. */
882 err |= __put_user(0, &frame->uc.uc_flags); 882 err |= __put_user(0, &frame->uc.uc_flags);
883 err |= __put_user(0, &frame->uc.uc_link); 883 err |= __put_user(NULL, &frame->uc.uc_link);
884 err |= __put_user((void *)current->sas_ss_sp, 884 err |= __put_user((void __user *)current->sas_ss_sp,
885 &frame->uc.uc_stack.ss_sp); 885 &frame->uc.uc_stack.ss_sp);
886 err |= __put_user(sas_ss_flags(rdusp()), 886 err |= __put_user(sas_ss_flags(rdusp()),
887 &frame->uc.uc_stack.ss_flags); 887 &frame->uc.uc_stack.ss_flags);
@@ -893,8 +893,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
893 err |= __put_user(frame->retcode, &frame->pretcode); 893 err |= __put_user(frame->retcode, &frame->pretcode);
894 /* moveq #,d0; notb d0; trap #0 */ 894 /* moveq #,d0; notb d0; trap #0 */
895 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16), 895 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
896 (long *)(frame->retcode + 0)); 896 (long __user *)(frame->retcode + 0));
897 err |= __put_user(0x4e40, (short *)(frame->retcode + 4)); 897 err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
898 898
899 if (err) 899 if (err)
900 goto give_sigsegv; 900 goto give_sigsegv;