diff options
Diffstat (limited to 'arch/s390/kernel/compat_signal.c')
-rw-r--r-- | arch/s390/kernel/compat_signal.c | 134 |
1 files changed, 2 insertions, 132 deletions
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 593fcc9253fc..3e71194c1902 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -157,122 +157,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | |||
157 | return err; | 157 | return err; |
158 | } | 158 | } |
159 | 159 | ||
160 | asmlinkage long | ||
161 | sys32_sigaction(int sig, const struct old_sigaction32 __user *act, | ||
162 | struct old_sigaction32 __user *oact) | ||
163 | { | ||
164 | struct k_sigaction new_ka, old_ka; | ||
165 | unsigned long sa_handler, sa_restorer; | ||
166 | int ret; | ||
167 | |||
168 | if (act) { | ||
169 | compat_old_sigset_t mask; | ||
170 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | ||
171 | __get_user(sa_handler, &act->sa_handler) || | ||
172 | __get_user(sa_restorer, &act->sa_restorer) || | ||
173 | __get_user(new_ka.sa.sa_flags, &act->sa_flags) || | ||
174 | __get_user(mask, &act->sa_mask)) | ||
175 | return -EFAULT; | ||
176 | new_ka.sa.sa_handler = (__sighandler_t) sa_handler; | ||
177 | new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer; | ||
178 | siginitset(&new_ka.sa.sa_mask, mask); | ||
179 | } | ||
180 | |||
181 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | ||
182 | |||
183 | if (!ret && oact) { | ||
184 | sa_handler = (unsigned long) old_ka.sa.sa_handler; | ||
185 | sa_restorer = (unsigned long) old_ka.sa.sa_restorer; | ||
186 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | ||
187 | __put_user(sa_handler, &oact->sa_handler) || | ||
188 | __put_user(sa_restorer, &oact->sa_restorer) || | ||
189 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags) || | ||
190 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask)) | ||
191 | return -EFAULT; | ||
192 | } | ||
193 | |||
194 | return ret; | ||
195 | } | ||
196 | |||
197 | asmlinkage long | ||
198 | sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, | ||
199 | struct sigaction32 __user *oact, size_t sigsetsize) | ||
200 | { | ||
201 | struct k_sigaction new_ka, old_ka; | ||
202 | unsigned long sa_handler; | ||
203 | int ret; | ||
204 | compat_sigset_t set32; | ||
205 | |||
206 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
207 | if (sigsetsize != sizeof(compat_sigset_t)) | ||
208 | return -EINVAL; | ||
209 | |||
210 | if (act) { | ||
211 | ret = get_user(sa_handler, &act->sa_handler); | ||
212 | ret |= __copy_from_user(&set32, &act->sa_mask, | ||
213 | sizeof(compat_sigset_t)); | ||
214 | new_ka.sa.sa_mask.sig[0] = | ||
215 | set32.sig[0] | (((long)set32.sig[1]) << 32); | ||
216 | ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); | ||
217 | |||
218 | if (ret) | ||
219 | return -EFAULT; | ||
220 | new_ka.sa.sa_handler = (__sighandler_t) sa_handler; | ||
221 | } | ||
222 | |||
223 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | ||
224 | |||
225 | if (!ret && oact) { | ||
226 | set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); | ||
227 | set32.sig[0] = old_ka.sa.sa_mask.sig[0]; | ||
228 | ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler); | ||
229 | ret |= __copy_to_user(&oact->sa_mask, &set32, | ||
230 | sizeof(compat_sigset_t)); | ||
231 | ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | ||
232 | } | ||
233 | |||
234 | return ret; | ||
235 | } | ||
236 | |||
237 | asmlinkage long | ||
238 | sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss) | ||
239 | { | ||
240 | struct pt_regs *regs = task_pt_regs(current); | ||
241 | stack_t kss, koss; | ||
242 | unsigned long ss_sp; | ||
243 | int ret, err = 0; | ||
244 | mm_segment_t old_fs = get_fs(); | ||
245 | |||
246 | if (uss) { | ||
247 | if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) | ||
248 | return -EFAULT; | ||
249 | err |= __get_user(ss_sp, &uss->ss_sp); | ||
250 | err |= __get_user(kss.ss_size, &uss->ss_size); | ||
251 | err |= __get_user(kss.ss_flags, &uss->ss_flags); | ||
252 | if (err) | ||
253 | return -EFAULT; | ||
254 | kss.ss_sp = (void __user *) ss_sp; | ||
255 | } | ||
256 | |||
257 | set_fs (KERNEL_DS); | ||
258 | ret = do_sigaltstack((stack_t __force __user *) (uss ? &kss : NULL), | ||
259 | (stack_t __force __user *) (uoss ? &koss : NULL), | ||
260 | regs->gprs[15]); | ||
261 | set_fs (old_fs); | ||
262 | |||
263 | if (!ret && uoss) { | ||
264 | if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) | ||
265 | return -EFAULT; | ||
266 | ss_sp = (unsigned long) koss.ss_sp; | ||
267 | err |= __put_user(ss_sp, &uoss->ss_sp); | ||
268 | err |= __put_user(koss.ss_size, &uoss->ss_size); | ||
269 | err |= __put_user(koss.ss_flags, &uoss->ss_flags); | ||
270 | if (err) | ||
271 | return -EFAULT; | ||
272 | } | ||
273 | return ret; | ||
274 | } | ||
275 | |||
276 | static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) | 160 | static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) |
277 | { | 161 | { |
278 | _s390_regs_common32 regs32; | 162 | _s390_regs_common32 regs32; |
@@ -380,10 +264,6 @@ asmlinkage long sys32_rt_sigreturn(void) | |||
380 | struct pt_regs *regs = task_pt_regs(current); | 264 | struct pt_regs *regs = task_pt_regs(current); |
381 | rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; | 265 | rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; |
382 | sigset_t set; | 266 | sigset_t set; |
383 | stack_t st; | ||
384 | __u32 ss_sp; | ||
385 | int err; | ||
386 | mm_segment_t old_fs = get_fs(); | ||
387 | 267 | ||
388 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 268 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
389 | goto badframe; | 269 | goto badframe; |
@@ -394,15 +274,8 @@ asmlinkage long sys32_rt_sigreturn(void) | |||
394 | goto badframe; | 274 | goto badframe; |
395 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) | 275 | if (restore_sigregs_gprs_high(regs, frame->gprs_high)) |
396 | goto badframe; | 276 | goto badframe; |
397 | err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); | 277 | if (compat_restore_altstack(&frame->uc.uc_stack)) |
398 | st.ss_sp = compat_ptr(ss_sp); | ||
399 | err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); | ||
400 | err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); | ||
401 | if (err) | ||
402 | goto badframe; | 278 | goto badframe; |
403 | set_fs (KERNEL_DS); | ||
404 | do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]); | ||
405 | set_fs (old_fs); | ||
406 | return regs->gprs[2]; | 279 | return regs->gprs[2]; |
407 | badframe: | 280 | badframe: |
408 | force_sig(SIGSEGV, current); | 281 | force_sig(SIGSEGV, current); |
@@ -530,10 +403,7 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
530 | /* Create the ucontext. */ | 403 | /* Create the ucontext. */ |
531 | err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags); | 404 | err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags); |
532 | err |= __put_user(0, &frame->uc.uc_link); | 405 | err |= __put_user(0, &frame->uc.uc_link); |
533 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 406 | err |= __compat_save_altstack(&frame->uc.uc_stack, regs->gprs[15]); |
534 | err |= __put_user(sas_ss_flags(regs->gprs[15]), | ||
535 | &frame->uc.uc_stack.ss_flags); | ||
536 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
537 | err |= save_sigregs32(regs, &frame->uc.uc_mcontext); | 407 | err |= save_sigregs32(regs, &frame->uc.uc_mcontext); |
538 | err |= save_sigregs_gprs_high(regs, frame->gprs_high); | 408 | err |= save_sigregs_gprs_high(regs, frame->gprs_high); |
539 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 409 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |