diff options
author | Richard Weinberger <richard@nod.at> | 2013-10-07 08:51:14 -0400 |
---|---|---|
committer | Richard Weinberger <richard@sigma-star.at> | 2014-08-06 07:03:19 -0400 |
commit | b46e848768acc458ba94feef162b8901592dbb9c (patch) | |
tree | d1e9b3be59fc9fa539304f692e184cafd5f6b5f0 /arch/sh | |
parent | 2bb12b773feb3e792145961e57ab356e6134d4a5 (diff) |
sh: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done()
for signal delivery.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/kernel/signal_32.c | 79 | ||||
-rw-r--r-- | arch/sh/kernel/signal_64.c | 82 |
2 files changed, 64 insertions, 97 deletions
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 594cd371aa28..2f002b24fb92 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -262,17 +262,17 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) | |||
262 | extern void __kernel_sigreturn(void); | 262 | extern void __kernel_sigreturn(void); |
263 | extern void __kernel_rt_sigreturn(void); | 263 | extern void __kernel_rt_sigreturn(void); |
264 | 264 | ||
265 | static int setup_frame(int sig, struct k_sigaction *ka, | 265 | static int setup_frame(struct ksignal *ksig, sigset_t *set, |
266 | sigset_t *set, struct pt_regs *regs) | 266 | struct pt_regs *regs) |
267 | { | 267 | { |
268 | struct sigframe __user *frame; | 268 | struct sigframe __user *frame; |
269 | int err = 0; | 269 | int err = 0, sig = ksig->sig; |
270 | int signal; | 270 | int signal; |
271 | 271 | ||
272 | frame = get_sigframe(ka, regs->regs[15], sizeof(*frame)); | 272 | frame = get_sigframe(&ksig->ka, regs->regs[15], sizeof(*frame)); |
273 | 273 | ||
274 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 274 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
275 | goto give_sigsegv; | 275 | return -EFAULT; |
276 | 276 | ||
277 | signal = current_thread_info()->exec_domain | 277 | signal = current_thread_info()->exec_domain |
278 | && current_thread_info()->exec_domain->signal_invmap | 278 | && current_thread_info()->exec_domain->signal_invmap |
@@ -288,8 +288,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
288 | 288 | ||
289 | /* Set up to return from userspace. If provided, use a stub | 289 | /* Set up to return from userspace. If provided, use a stub |
290 | already in userspace. */ | 290 | already in userspace. */ |
291 | if (ka->sa.sa_flags & SA_RESTORER) { | 291 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |
292 | regs->pr = (unsigned long) ka->sa.sa_restorer; | 292 | regs->pr = (unsigned long) ksig->ka.sa.sa_restorer; |
293 | #ifdef CONFIG_VSYSCALL | 293 | #ifdef CONFIG_VSYSCALL |
294 | } else if (likely(current->mm->context.vdso)) { | 294 | } else if (likely(current->mm->context.vdso)) { |
295 | regs->pr = VDSO_SYM(&__kernel_sigreturn); | 295 | regs->pr = VDSO_SYM(&__kernel_sigreturn); |
@@ -309,7 +309,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
309 | } | 309 | } |
310 | 310 | ||
311 | if (err) | 311 | if (err) |
312 | goto give_sigsegv; | 312 | return -EFAULT; |
313 | 313 | ||
314 | /* Set up registers for signal handler */ | 314 | /* Set up registers for signal handler */ |
315 | regs->regs[15] = (unsigned long) frame; | 315 | regs->regs[15] = (unsigned long) frame; |
@@ -319,15 +319,15 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
319 | 319 | ||
320 | if (current->personality & FDPIC_FUNCPTRS) { | 320 | if (current->personality & FDPIC_FUNCPTRS) { |
321 | struct fdpic_func_descriptor __user *funcptr = | 321 | struct fdpic_func_descriptor __user *funcptr = |
322 | (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; | 322 | (struct fdpic_func_descriptor __user *)ksig->ka.sa.sa_handler; |
323 | 323 | ||
324 | err |= __get_user(regs->pc, &funcptr->text); | 324 | err |= __get_user(regs->pc, &funcptr->text); |
325 | err |= __get_user(regs->regs[12], &funcptr->GOT); | 325 | err |= __get_user(regs->regs[12], &funcptr->GOT); |
326 | } else | 326 | } else |
327 | regs->pc = (unsigned long)ka->sa.sa_handler; | 327 | regs->pc = (unsigned long)ksig->ka.sa.sa_handler; |
328 | 328 | ||
329 | if (err) | 329 | if (err) |
330 | goto give_sigsegv; | 330 | return -EFAULT; |
331 | 331 | ||
332 | set_fs(USER_DS); | 332 | set_fs(USER_DS); |
333 | 333 | ||
@@ -335,23 +335,19 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
335 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); | 335 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); |
336 | 336 | ||
337 | return 0; | 337 | return 0; |
338 | |||
339 | give_sigsegv: | ||
340 | force_sigsegv(sig, current); | ||
341 | return -EFAULT; | ||
342 | } | 338 | } |
343 | 339 | ||
344 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 340 | static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, |
345 | sigset_t *set, struct pt_regs *regs) | 341 | struct pt_regs *regs) |
346 | { | 342 | { |
347 | struct rt_sigframe __user *frame; | 343 | struct rt_sigframe __user *frame; |
348 | int err = 0; | 344 | int err = 0, sig = ksig->sig; |
349 | int signal; | 345 | int signal; |
350 | 346 | ||
351 | frame = get_sigframe(ka, regs->regs[15], sizeof(*frame)); | 347 | frame = get_sigframe(&ksig->ka, regs->regs[15], sizeof(*frame)); |
352 | 348 | ||
353 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 349 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
354 | goto give_sigsegv; | 350 | return -EFAULT; |
355 | 351 | ||
356 | signal = current_thread_info()->exec_domain | 352 | signal = current_thread_info()->exec_domain |
357 | && current_thread_info()->exec_domain->signal_invmap | 353 | && current_thread_info()->exec_domain->signal_invmap |
@@ -359,7 +355,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
359 | ? current_thread_info()->exec_domain->signal_invmap[sig] | 355 | ? current_thread_info()->exec_domain->signal_invmap[sig] |
360 | : sig; | 356 | : sig; |
361 | 357 | ||
362 | err |= copy_siginfo_to_user(&frame->info, info); | 358 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
363 | 359 | ||
364 | /* Create the ucontext. */ | 360 | /* Create the ucontext. */ |
365 | err |= __put_user(0, &frame->uc.uc_flags); | 361 | err |= __put_user(0, &frame->uc.uc_flags); |
@@ -371,8 +367,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
371 | 367 | ||
372 | /* Set up to return from userspace. If provided, use a stub | 368 | /* Set up to return from userspace. If provided, use a stub |
373 | already in userspace. */ | 369 | already in userspace. */ |
374 | if (ka->sa.sa_flags & SA_RESTORER) { | 370 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |
375 | regs->pr = (unsigned long) ka->sa.sa_restorer; | 371 | regs->pr = (unsigned long) ksig->ka.sa.sa_restorer; |
376 | #ifdef CONFIG_VSYSCALL | 372 | #ifdef CONFIG_VSYSCALL |
377 | } else if (likely(current->mm->context.vdso)) { | 373 | } else if (likely(current->mm->context.vdso)) { |
378 | regs->pr = VDSO_SYM(&__kernel_rt_sigreturn); | 374 | regs->pr = VDSO_SYM(&__kernel_rt_sigreturn); |
@@ -392,7 +388,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
392 | } | 388 | } |
393 | 389 | ||
394 | if (err) | 390 | if (err) |
395 | goto give_sigsegv; | 391 | return -EFAULT; |
396 | 392 | ||
397 | /* Set up registers for signal handler */ | 393 | /* Set up registers for signal handler */ |
398 | regs->regs[15] = (unsigned long) frame; | 394 | regs->regs[15] = (unsigned long) frame; |
@@ -402,15 +398,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
402 | 398 | ||
403 | if (current->personality & FDPIC_FUNCPTRS) { | 399 | if (current->personality & FDPIC_FUNCPTRS) { |
404 | struct fdpic_func_descriptor __user *funcptr = | 400 | struct fdpic_func_descriptor __user *funcptr = |
405 | (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; | 401 | (struct fdpic_func_descriptor __user *)ksig->ka.sa.sa_handler; |
406 | 402 | ||
407 | err |= __get_user(regs->pc, &funcptr->text); | 403 | err |= __get_user(regs->pc, &funcptr->text); |
408 | err |= __get_user(regs->regs[12], &funcptr->GOT); | 404 | err |= __get_user(regs->regs[12], &funcptr->GOT); |
409 | } else | 405 | } else |
410 | regs->pc = (unsigned long)ka->sa.sa_handler; | 406 | regs->pc = (unsigned long)ksig->ka.sa.sa_handler; |
411 | 407 | ||
412 | if (err) | 408 | if (err) |
413 | goto give_sigsegv; | 409 | return -EFAULT; |
414 | 410 | ||
415 | set_fs(USER_DS); | 411 | set_fs(USER_DS); |
416 | 412 | ||
@@ -418,10 +414,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
418 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); | 414 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); |
419 | 415 | ||
420 | return 0; | 416 | return 0; |
421 | |||
422 | give_sigsegv: | ||
423 | force_sigsegv(sig, current); | ||
424 | return -EFAULT; | ||
425 | } | 417 | } |
426 | 418 | ||
427 | static inline void | 419 | static inline void |
@@ -455,22 +447,18 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
455 | * OK, we're invoking a handler | 447 | * OK, we're invoking a handler |
456 | */ | 448 | */ |
457 | static void | 449 | static void |
458 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 450 | handle_signal(struct ksignal *ksig, struct pt_regs *regs, unsigned int save_r0) |
459 | struct pt_regs *regs, unsigned int save_r0) | ||
460 | { | 451 | { |
461 | sigset_t *oldset = sigmask_to_save(); | 452 | sigset_t *oldset = sigmask_to_save(); |
462 | int ret; | 453 | int ret; |
463 | 454 | ||
464 | /* Set up the stack frame */ | 455 | /* Set up the stack frame */ |
465 | if (ka->sa.sa_flags & SA_SIGINFO) | 456 | if (ksig->ka.sa.sa_flags & SA_SIGINFO) |
466 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 457 | ret = setup_rt_frame(ksig, oldset, regs); |
467 | else | 458 | else |
468 | ret = setup_frame(sig, ka, oldset, regs); | 459 | ret = setup_frame(ksig, oldset, regs); |
469 | 460 | ||
470 | if (ret) | 461 | signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); |
471 | return; | ||
472 | signal_delivered(sig, info, ka, regs, | ||
473 | test_thread_flag(TIF_SINGLESTEP)); | ||
474 | } | 462 | } |
475 | 463 | ||
476 | /* | 464 | /* |
@@ -484,9 +472,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
484 | */ | 472 | */ |
485 | static void do_signal(struct pt_regs *regs, unsigned int save_r0) | 473 | static void do_signal(struct pt_regs *regs, unsigned int save_r0) |
486 | { | 474 | { |
487 | siginfo_t info; | 475 | struct ksignal ksig; |
488 | int signr; | ||
489 | struct k_sigaction ka; | ||
490 | 476 | ||
491 | /* | 477 | /* |
492 | * We want the common case to go fast, which | 478 | * We want the common case to go fast, which |
@@ -497,12 +483,11 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
497 | if (!user_mode(regs)) | 483 | if (!user_mode(regs)) |
498 | return; | 484 | return; |
499 | 485 | ||
500 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 486 | if (get_signal(&ksig)) { |
501 | if (signr > 0) { | 487 | handle_syscall_restart(save_r0, regs, &ksig.ka.sa); |
502 | handle_syscall_restart(save_r0, regs, &ka.sa); | ||
503 | 488 | ||
504 | /* Whee! Actually deliver the signal. */ | 489 | /* Whee! Actually deliver the signal. */ |
505 | handle_signal(signr, &ka, &info, regs, save_r0); | 490 | handle_signal(&ksig, regs, save_r0); |
506 | return; | 491 | return; |
507 | } | 492 | } |
508 | 493 | ||
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index 23d4c71c91af..897abe7b871e 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -41,8 +41,7 @@ | |||
41 | #define DEBUG_SIG 0 | 41 | #define DEBUG_SIG 0 |
42 | 42 | ||
43 | static void | 43 | static void |
44 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 44 | handle_signal(struct ksignal *ksig, struct pt_regs *regs); |
45 | struct pt_regs * regs); | ||
46 | 45 | ||
47 | static inline void | 46 | static inline void |
48 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | 47 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) |
@@ -82,9 +81,7 @@ handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | |||
82 | */ | 81 | */ |
83 | static void do_signal(struct pt_regs *regs) | 82 | static void do_signal(struct pt_regs *regs) |
84 | { | 83 | { |
85 | siginfo_t info; | 84 | struct ksignal ksig; |
86 | int signr; | ||
87 | struct k_sigaction ka; | ||
88 | 85 | ||
89 | /* | 86 | /* |
90 | * We want the common case to go fast, which | 87 | * We want the common case to go fast, which |
@@ -95,12 +92,11 @@ static void do_signal(struct pt_regs *regs) | |||
95 | if (!user_mode(regs)) | 92 | if (!user_mode(regs)) |
96 | return; | 93 | return; |
97 | 94 | ||
98 | signr = get_signal_to_deliver(&info, &ka, regs, 0); | 95 | if (get_signal(&ksig)) { |
99 | if (signr > 0) { | 96 | handle_syscall_restart(regs, &ksig.ka.sa); |
100 | handle_syscall_restart(regs, &ka.sa); | ||
101 | 97 | ||
102 | /* Whee! Actually deliver the signal. */ | 98 | /* Whee! Actually deliver the signal. */ |
103 | handle_signal(signr, &info, &ka, regs); | 99 | handle_signal(&ksig, regs); |
104 | return; | 100 | return; |
105 | } | 101 | } |
106 | 102 | ||
@@ -378,17 +374,16 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) | |||
378 | void sa_default_restorer(void); /* See comments below */ | 374 | void sa_default_restorer(void); /* See comments below */ |
379 | void sa_default_rt_restorer(void); /* See comments below */ | 375 | void sa_default_rt_restorer(void); /* See comments below */ |
380 | 376 | ||
381 | static int setup_frame(int sig, struct k_sigaction *ka, | 377 | static int setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) |
382 | sigset_t *set, struct pt_regs *regs) | ||
383 | { | 378 | { |
384 | struct sigframe __user *frame; | 379 | struct sigframe __user *frame; |
385 | int err = 0; | 380 | int err = 0, sig = ksig->sig; |
386 | int signal; | 381 | int signal; |
387 | 382 | ||
388 | frame = get_sigframe(ka, regs->regs[REG_SP], sizeof(*frame)); | 383 | frame = get_sigframe(&ksig->ka, regs->regs[REG_SP], sizeof(*frame)); |
389 | 384 | ||
390 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 385 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
391 | goto give_sigsegv; | 386 | return -EFAULT; |
392 | 387 | ||
393 | signal = current_thread_info()->exec_domain | 388 | signal = current_thread_info()->exec_domain |
394 | && current_thread_info()->exec_domain->signal_invmap | 389 | && current_thread_info()->exec_domain->signal_invmap |
@@ -400,7 +395,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
400 | 395 | ||
401 | /* Give up earlier as i386, in case */ | 396 | /* Give up earlier as i386, in case */ |
402 | if (err) | 397 | if (err) |
403 | goto give_sigsegv; | 398 | return -EFAULT; |
404 | 399 | ||
405 | if (_NSIG_WORDS > 1) { | 400 | if (_NSIG_WORDS > 1) { |
406 | err |= __copy_to_user(frame->extramask, &set->sig[1], | 401 | err |= __copy_to_user(frame->extramask, &set->sig[1], |
@@ -408,16 +403,16 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
408 | 403 | ||
409 | /* Give up earlier as i386, in case */ | 404 | /* Give up earlier as i386, in case */ |
410 | if (err) | 405 | if (err) |
411 | goto give_sigsegv; | 406 | return -EFAULT; |
412 | 407 | ||
413 | /* Set up to return from userspace. If provided, use a stub | 408 | /* Set up to return from userspace. If provided, use a stub |
414 | already in userspace. */ | 409 | already in userspace. */ |
415 | if (ka->sa.sa_flags & SA_RESTORER) { | 410 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |
416 | /* | 411 | /* |
417 | * On SH5 all edited pointers are subject to NEFF | 412 | * On SH5 all edited pointers are subject to NEFF |
418 | */ | 413 | */ |
419 | DEREF_REG_PR = neff_sign_extend((unsigned long) | 414 | DEREF_REG_PR = neff_sign_extend((unsigned long) |
420 | ka->sa.sa_restorer | 0x1); | 415 | ksig->ka->sa.sa_restorer | 0x1); |
421 | } else { | 416 | } else { |
422 | /* | 417 | /* |
423 | * Different approach on SH5. | 418 | * Different approach on SH5. |
@@ -435,7 +430,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
435 | 430 | ||
436 | if (__copy_to_user(frame->retcode, | 431 | if (__copy_to_user(frame->retcode, |
437 | (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0) | 432 | (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0) |
438 | goto give_sigsegv; | 433 | return -EFAULT; |
439 | 434 | ||
440 | /* Cohere the trampoline with the I-cache. */ | 435 | /* Cohere the trampoline with the I-cache. */ |
441 | flush_cache_sigtramp(DEREF_REG_PR-1); | 436 | flush_cache_sigtramp(DEREF_REG_PR-1); |
@@ -460,7 +455,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
460 | regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc; | 455 | regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc; |
461 | regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc; | 456 | regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc; |
462 | 457 | ||
463 | regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler); | 458 | regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler); |
464 | 459 | ||
465 | set_fs(USER_DS); | 460 | set_fs(USER_DS); |
466 | 461 | ||
@@ -471,23 +466,19 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
471 | DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); | 466 | DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); |
472 | 467 | ||
473 | return 0; | 468 | return 0; |
474 | |||
475 | give_sigsegv: | ||
476 | force_sigsegv(sig, current); | ||
477 | return -EFAULT; | ||
478 | } | 469 | } |
479 | 470 | ||
480 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 471 | static int setup_rt_frame(struct ksignal *kig, sigset_t *set, |
481 | sigset_t *set, struct pt_regs *regs) | 472 | struct pt_regs *regs) |
482 | { | 473 | { |
483 | struct rt_sigframe __user *frame; | 474 | struct rt_sigframe __user *frame; |
484 | int err = 0; | 475 | int err = 0, sig = ksig->sig; |
485 | int signal; | 476 | int signal; |
486 | 477 | ||
487 | frame = get_sigframe(ka, regs->regs[REG_SP], sizeof(*frame)); | 478 | frame = get_sigframe(&ksig->ka, regs->regs[REG_SP], sizeof(*frame)); |
488 | 479 | ||
489 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 480 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
490 | goto give_sigsegv; | 481 | return -EFAULT; |
491 | 482 | ||
492 | signal = current_thread_info()->exec_domain | 483 | signal = current_thread_info()->exec_domain |
493 | && current_thread_info()->exec_domain->signal_invmap | 484 | && current_thread_info()->exec_domain->signal_invmap |
@@ -497,11 +488,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
497 | 488 | ||
498 | err |= __put_user(&frame->info, &frame->pinfo); | 489 | err |= __put_user(&frame->info, &frame->pinfo); |
499 | err |= __put_user(&frame->uc, &frame->puc); | 490 | err |= __put_user(&frame->uc, &frame->puc); |
500 | err |= copy_siginfo_to_user(&frame->info, info); | 491 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
501 | 492 | ||
502 | /* Give up earlier as i386, in case */ | 493 | /* Give up earlier as i386, in case */ |
503 | if (err) | 494 | if (err) |
504 | goto give_sigsegv; | 495 | return -EFAULT; |
505 | 496 | ||
506 | /* Create the ucontext. */ | 497 | /* Create the ucontext. */ |
507 | err |= __put_user(0, &frame->uc.uc_flags); | 498 | err |= __put_user(0, &frame->uc.uc_flags); |
@@ -513,16 +504,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
513 | 504 | ||
514 | /* Give up earlier as i386, in case */ | 505 | /* Give up earlier as i386, in case */ |
515 | if (err) | 506 | if (err) |
516 | goto give_sigsegv; | 507 | return -EFAULT; |
517 | 508 | ||
518 | /* Set up to return from userspace. If provided, use a stub | 509 | /* Set up to return from userspace. If provided, use a stub |
519 | already in userspace. */ | 510 | already in userspace. */ |
520 | if (ka->sa.sa_flags & SA_RESTORER) { | 511 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |
521 | /* | 512 | /* |
522 | * On SH5 all edited pointers are subject to NEFF | 513 | * On SH5 all edited pointers are subject to NEFF |
523 | */ | 514 | */ |
524 | DEREF_REG_PR = neff_sign_extend((unsigned long) | 515 | DEREF_REG_PR = neff_sign_extend((unsigned long) |
525 | ka->sa.sa_restorer | 0x1); | 516 | ksig->ka.sa.sa_restorer | 0x1); |
526 | } else { | 517 | } else { |
527 | /* | 518 | /* |
528 | * Different approach on SH5. | 519 | * Different approach on SH5. |
@@ -540,7 +531,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
540 | 531 | ||
541 | if (__copy_to_user(frame->retcode, | 532 | if (__copy_to_user(frame->retcode, |
542 | (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0) | 533 | (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0) |
543 | goto give_sigsegv; | 534 | return -EFAULT; |
544 | 535 | ||
545 | /* Cohere the trampoline with the I-cache. */ | 536 | /* Cohere the trampoline with the I-cache. */ |
546 | flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15); | 537 | flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15); |
@@ -554,7 +545,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
554 | regs->regs[REG_ARG1] = signal; /* Arg for signal handler */ | 545 | regs->regs[REG_ARG1] = signal; /* Arg for signal handler */ |
555 | regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info; | 546 | regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info; |
556 | regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext; | 547 | regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext; |
557 | regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler); | 548 | regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler); |
558 | 549 | ||
559 | set_fs(USER_DS); | 550 | set_fs(USER_DS); |
560 | 551 | ||
@@ -564,33 +555,24 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
564 | DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); | 555 | DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); |
565 | 556 | ||
566 | return 0; | 557 | return 0; |
567 | |||
568 | give_sigsegv: | ||
569 | force_sigsegv(sig, current); | ||
570 | return -EFAULT; | ||
571 | } | 558 | } |
572 | 559 | ||
573 | /* | 560 | /* |
574 | * OK, we're invoking a handler | 561 | * OK, we're invoking a handler |
575 | */ | 562 | */ |
576 | static void | 563 | static void |
577 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 564 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
578 | struct pt_regs * regs) | ||
579 | { | 565 | { |
580 | sigset_t *oldset = sigmask_to_save(); | 566 | sigset_t *oldset = sigmask_to_save(); |
581 | int ret; | 567 | int ret; |
582 | 568 | ||
583 | /* Set up the stack frame */ | 569 | /* Set up the stack frame */ |
584 | if (ka->sa.sa_flags & SA_SIGINFO) | 570 | if (ksig->ka.sa.sa_flags & SA_SIGINFO) |
585 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 571 | ret = setup_rt_frame(ksig, oldset, regs); |
586 | else | 572 | else |
587 | ret = setup_frame(sig, ka, oldset, regs); | 573 | ret = setup_frame(ksig, oldset, regs); |
588 | |||
589 | if (ret) | ||
590 | return; | ||
591 | 574 | ||
592 | signal_delivered(sig, info, ka, regs, | 575 | signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); |
593 | test_thread_flag(TIF_SINGLESTEP)); | ||
594 | } | 576 | } |
595 | 577 | ||
596 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 578 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |