aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/signal-common.h8
-rw-r--r--arch/mips/kernel/signal.c14
-rw-r--r--arch/mips/kernel/signal32.c57
-rw-r--r--arch/mips/kernel/signal_n32.c8
4 files changed, 45 insertions, 42 deletions
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0f66ae5838b9..0fbc492d24b4 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -11,7 +11,7 @@
11#include <linux/config.h> 11#include <linux/config.h>
12 12
13static inline int 13static inline int
14setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 14setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
15{ 15{
16 int err = 0; 16 int err = 0;
17 17
@@ -82,7 +82,7 @@ out:
82} 82}
83 83
84static inline int 84static inline int
85restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 85restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
86{ 86{
87 unsigned int used_math; 87 unsigned int used_math;
88 unsigned long treg; 88 unsigned long treg;
@@ -157,7 +157,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
157/* 157/*
158 * Determine which stack to use.. 158 * Determine which stack to use..
159 */ 159 */
160static inline void * 160static inline void __user *
161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
162{ 162{
163 unsigned long sp; 163 unsigned long sp;
@@ -176,7 +176,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
177 sp = current->sas_ss_sp + current->sas_ss_size; 177 sp = current->sas_ss_sp + current->sas_ss_size;
178 178
179 return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); 179 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK));
180} 180}
181 181
182static inline int install_sigtramp(unsigned int __user *tramp, 182static inline int install_sigtramp(unsigned int __user *tramp,
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 7d1800fe7038..e8e43bd57a09 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -199,10 +199,10 @@ save_static_function(sys_sigreturn);
199__attribute_used__ noinline static void 199__attribute_used__ noinline static void
200_sys_sigreturn(nabi_no_regargs struct pt_regs regs) 200_sys_sigreturn(nabi_no_regargs struct pt_regs regs)
201{ 201{
202 struct sigframe *frame; 202 struct sigframe __user *frame;
203 sigset_t blocked; 203 sigset_t blocked;
204 204
205 frame = (struct sigframe *) regs.regs[29]; 205 frame = (struct sigframe __user *) regs.regs[29];
206 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 206 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
207 goto badframe; 207 goto badframe;
208 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 208 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -236,11 +236,11 @@ save_static_function(sys_rt_sigreturn);
236__attribute_used__ noinline static void 236__attribute_used__ noinline static void
237_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 237_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
238{ 238{
239 struct rt_sigframe *frame; 239 struct rt_sigframe __user *frame;
240 sigset_t set; 240 sigset_t set;
241 stack_t st; 241 stack_t st;
242 242
243 frame = (struct rt_sigframe *) regs.regs[29]; 243 frame = (struct rt_sigframe __user *) regs.regs[29];
244 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 244 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
245 goto badframe; 245 goto badframe;
246 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 246 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -259,7 +259,7 @@ _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
259 goto badframe; 259 goto badframe;
260 /* It is more difficult to avoid calling this function than to 260 /* It is more difficult to avoid calling this function than to
261 call it and ignore errors. */ 261 call it and ignore errors. */
262 do_sigaltstack(&st, NULL, regs.regs[29]); 262 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
263 263
264 /* 264 /*
265 * Don't let your children do this ... 265 * Don't let your children do this ...
@@ -279,7 +279,7 @@ badframe:
279int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, 279int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
280 int signr, sigset_t *set) 280 int signr, sigset_t *set)
281{ 281{
282 struct sigframe *frame; 282 struct sigframe __user *frame;
283 int err = 0; 283 int err = 0;
284 284
285 frame = get_sigframe(ka, regs, sizeof(*frame)); 285 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -326,7 +326,7 @@ give_sigsegv:
326int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, 326int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
327 int signr, sigset_t *set, siginfo_t *info) 327 int signr, sigset_t *set, siginfo_t *info)
328{ 328{
329 struct rt_sigframe *frame; 329 struct rt_sigframe __user *frame;
330 int err = 0; 330 int err = 0;
331 331
332 frame = get_sigframe(ka, regs, sizeof(*frame)); 332 frame = get_sigframe(ka, regs, sizeof(*frame));
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 98b185bbc947..7c2241e4d779 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -144,7 +144,7 @@ struct ucontext32 {
144extern void __put_sigset_unknown_nsig(void); 144extern void __put_sigset_unknown_nsig(void);
145extern void __get_sigset_unknown_nsig(void); 145extern void __get_sigset_unknown_nsig(void);
146 146
147static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf) 147static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
148{ 148{
149 int err = 0; 149 int err = 0;
150 150
@@ -269,7 +269,7 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
269 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 269 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
270 return -EFAULT; 270 return -EFAULT;
271 err |= __get_user(handler, &act->sa_handler); 271 err |= __get_user(handler, &act->sa_handler);
272 new_ka.sa.sa_handler = (void*)(s64)handler; 272 new_ka.sa.sa_handler = (void __user *)(s64)handler;
273 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); 273 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
274 err |= __get_user(mask, &act->sa_mask.sig[0]); 274 err |= __get_user(mask, &act->sa_mask.sig[0]);
275 if (err) 275 if (err)
@@ -299,8 +299,8 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
299 299
300asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) 300asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
301{ 301{
302 const stack32_t *uss = (const stack32_t *) regs.regs[4]; 302 const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4];
303 stack32_t *uoss = (stack32_t *) regs.regs[5]; 303 stack32_t __user *uoss = (stack32_t __user *) regs.regs[5];
304 unsigned long usp = regs.regs[29]; 304 unsigned long usp = regs.regs[29];
305 stack_t kss, koss; 305 stack_t kss, koss;
306 int ret, err = 0; 306 int ret, err = 0;
@@ -319,7 +319,8 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
319 } 319 }
320 320
321 set_fs (KERNEL_DS); 321 set_fs (KERNEL_DS);
322 ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp); 322 ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL,
323 uoss ? (stack_t __user *)&koss : NULL, usp);
323 set_fs (old_fs); 324 set_fs (old_fs);
324 325
325 if (!ret && uoss) { 326 if (!ret && uoss) {
@@ -335,7 +336,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
335 return ret; 336 return ret;
336} 337}
337 338
338static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc) 339static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc)
339{ 340{
340 u32 used_math; 341 u32 used_math;
341 int err = 0; 342 int err = 0;
@@ -420,7 +421,7 @@ struct rt_sigframe32 {
420#endif 421#endif
421}; 422};
422 423
423int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) 424int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
424{ 425{
425 int err; 426 int err;
426 427
@@ -476,10 +477,10 @@ save_static_function(sys32_sigreturn);
476__attribute_used__ noinline static void 477__attribute_used__ noinline static void
477_sys32_sigreturn(nabi_no_regargs struct pt_regs regs) 478_sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
478{ 479{
479 struct sigframe *frame; 480 struct sigframe __user *frame;
480 sigset_t blocked; 481 sigset_t blocked;
481 482
482 frame = (struct sigframe *) regs.regs[29]; 483 frame = (struct sigframe __user *) regs.regs[29];
483 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 484 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
484 goto badframe; 485 goto badframe;
485 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 486 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -512,13 +513,13 @@ save_static_function(sys32_rt_sigreturn);
512__attribute_used__ noinline static void 513__attribute_used__ noinline static void
513_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 514_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
514{ 515{
515 struct rt_sigframe32 *frame; 516 struct rt_sigframe32 __user *frame;
516 mm_segment_t old_fs; 517 mm_segment_t old_fs;
517 sigset_t set; 518 sigset_t set;
518 stack_t st; 519 stack_t st;
519 s32 sp; 520 s32 sp;
520 521
521 frame = (struct rt_sigframe32 *) regs.regs[29]; 522 frame = (struct rt_sigframe32 __user *) regs.regs[29];
522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 523 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
523 goto badframe; 524 goto badframe;
524 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 525 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -546,7 +547,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
546 call it and ignore errors. */ 547 call it and ignore errors. */
547 old_fs = get_fs(); 548 old_fs = get_fs();
548 set_fs (KERNEL_DS); 549 set_fs (KERNEL_DS);
549 do_sigaltstack(&st, NULL, regs.regs[29]); 550 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
550 set_fs (old_fs); 551 set_fs (old_fs);
551 552
552 /* 553 /*
@@ -564,7 +565,7 @@ badframe:
564} 565}
565 566
566static inline int setup_sigcontext32(struct pt_regs *regs, 567static inline int setup_sigcontext32(struct pt_regs *regs,
567 struct sigcontext32 *sc) 568 struct sigcontext32 __user *sc)
568{ 569{
569 int err = 0; 570 int err = 0;
570 571
@@ -623,8 +624,9 @@ out:
623/* 624/*
624 * Determine which stack to use.. 625 * Determine which stack to use..
625 */ 626 */
626static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 627static inline void __user *get_sigframe(struct k_sigaction *ka,
627 size_t frame_size) 628 struct pt_regs *regs,
629 size_t frame_size)
628{ 630{
629 unsigned long sp; 631 unsigned long sp;
630 632
@@ -642,13 +644,13 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
642 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 644 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
643 sp = current->sas_ss_sp + current->sas_ss_size; 645 sp = current->sas_ss_sp + current->sas_ss_size;
644 646
645 return (void *)((sp - frame_size) & ALMASK); 647 return (void __user *)((sp - frame_size) & ALMASK);
646} 648}
647 649
648int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 650int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
649 int signr, sigset_t *set) 651 int signr, sigset_t *set)
650{ 652{
651 struct sigframe *frame; 653 struct sigframe __user *frame;
652 int err = 0; 654 int err = 0;
653 655
654 frame = get_sigframe(ka, regs, sizeof(*frame)); 656 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -702,7 +704,7 @@ give_sigsegv:
702int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
703 int signr, sigset_t *set, siginfo_t *info) 705 int signr, sigset_t *set, siginfo_t *info)
704{ 706{
705 struct rt_sigframe32 *frame; 707 struct rt_sigframe32 __user *frame;
706 int err = 0; 708 int err = 0;
707 s32 sp; 709 s32 sp;
708 710
@@ -855,7 +857,7 @@ no_signal:
855} 857}
856 858
857asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, 859asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
858 struct sigaction32 *oact, 860 struct sigaction32 __user *oact,
859 unsigned int sigsetsize) 861 unsigned int sigsetsize)
860{ 862{
861 struct k_sigaction new_sa, old_sa; 863 struct k_sigaction new_sa, old_sa;
@@ -872,7 +874,7 @@ asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
872 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 874 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
873 return -EFAULT; 875 return -EFAULT;
874 err |= __get_user(handler, &act->sa_handler); 876 err |= __get_user(handler, &act->sa_handler);
875 new_sa.sa.sa_handler = (void*)(s64)handler; 877 new_sa.sa.sa_handler = (void __user *)(s64)handler;
876 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); 878 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
877 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); 879 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
878 if (err) 880 if (err)
@@ -899,7 +901,7 @@ out:
899} 901}
900 902
901asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, 903asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
902 compat_sigset_t *oset, unsigned int sigsetsize) 904 compat_sigset_t __user *oset, unsigned int sigsetsize)
903{ 905{
904 sigset_t old_set, new_set; 906 sigset_t old_set, new_set;
905 int ret; 907 int ret;
@@ -909,8 +911,9 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
909 return -EFAULT; 911 return -EFAULT;
910 912
911 set_fs (KERNEL_DS); 913 set_fs (KERNEL_DS);
912 ret = sys_rt_sigprocmask(how, set ? &new_set : NULL, 914 ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL,
913 oset ? &old_set : NULL, sigsetsize); 915 oset ? (sigset_t __user *)&old_set : NULL,
916 sigsetsize);
914 set_fs (old_fs); 917 set_fs (old_fs);
915 918
916 if (!ret && oset && put_sigset(&old_set, oset)) 919 if (!ret && oset && put_sigset(&old_set, oset))
@@ -919,7 +922,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
919 return ret; 922 return ret;
920} 923}
921 924
922asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, 925asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
923 unsigned int sigsetsize) 926 unsigned int sigsetsize)
924{ 927{
925 int ret; 928 int ret;
@@ -927,7 +930,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
927 mm_segment_t old_fs = get_fs(); 930 mm_segment_t old_fs = get_fs();
928 931
929 set_fs (KERNEL_DS); 932 set_fs (KERNEL_DS);
930 ret = sys_rt_sigpending(&set, sigsetsize); 933 ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize);
931 set_fs (old_fs); 934 set_fs (old_fs);
932 935
933 if (!ret && put_sigset(&set, uset)) 936 if (!ret && put_sigset(&set, uset))
@@ -936,7 +939,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
936 return ret; 939 return ret;
937} 940}
938 941
939asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) 942asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
940{ 943{
941 siginfo_t info; 944 siginfo_t info;
942 int ret; 945 int ret;
@@ -946,7 +949,7 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo)
946 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) 949 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
947 return -EFAULT; 950 return -EFAULT;
948 set_fs (KERNEL_DS); 951 set_fs (KERNEL_DS);
949 ret = sys_rt_sigqueueinfo(pid, sig, &info); 952 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
950 set_fs (old_fs); 953 set_fs (old_fs);
951 return ret; 954 return ret;
952} 955}
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ec61b2670ba6..3d2f8e39cede 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -83,12 +83,12 @@ save_static_function(sysn32_rt_sigreturn);
83__attribute_used__ noinline static void 83__attribute_used__ noinline static void
84_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 84_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
85{ 85{
86 struct rt_sigframe_n32 *frame; 86 struct rt_sigframe_n32 __user *frame;
87 sigset_t set; 87 sigset_t set;
88 stack_t st; 88 stack_t st;
89 s32 sp; 89 s32 sp;
90 90
91 frame = (struct rt_sigframe_n32 *) regs.regs[29]; 91 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
92 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 92 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
93 goto badframe; 93 goto badframe;
94 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 94 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -114,7 +114,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
114 114
115 /* It is more difficult to avoid calling this function than to 115 /* It is more difficult to avoid calling this function than to
116 call it and ignore errors. */ 116 call it and ignore errors. */
117 do_sigaltstack(&st, NULL, regs.regs[29]); 117 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
118 118
119 /* 119 /*
120 * Don't let your children do this ... 120 * Don't let your children do this ...
@@ -133,7 +133,7 @@ badframe:
133int setup_rt_frame_n32(struct k_sigaction * ka, 133int setup_rt_frame_n32(struct k_sigaction * ka,
134 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) 134 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info)
135{ 135{
136 struct rt_sigframe_n32 *frame; 136 struct rt_sigframe_n32 __user *frame;
137 int err = 0; 137 int err = 0;
138 s32 sp; 138 s32 sp;
139 139