diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-09-12 20:01:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-14 09:35:34 -0400 |
commit | 3d0aedd9538e6be8afec1a9d8b084bf90bc91495 (patch) | |
tree | f1dd505b2a703343a0c5dc0ab3a7c2e98949f1f8 /arch/x86/ia32 | |
parent | 764e8d128f9343027cf09afe8a145e8ff186e129 (diff) |
x86: signal: put give_sigsegv of setup frames together
When setup frame fails, force_sigsegv is called and returns -EFAULT.
There is similar code in ia32_setup_frame(), ia32_setup_rt_frame(),
__setup_frame() and __setup_rt_frame().
Make them identical.
No change in functionality intended.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r-- | arch/x86/ia32/ia32_signal.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 8d64c1bc8474..5f42cfcc1c5a 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -444,21 +444,21 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
444 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 444 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
445 | 445 | ||
446 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 446 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
447 | goto give_sigsegv; | 447 | return -EFAULT; |
448 | 448 | ||
449 | err |= __put_user(sig, &frame->sig); | 449 | err |= __put_user(sig, &frame->sig); |
450 | if (err) | 450 | if (err) |
451 | goto give_sigsegv; | 451 | return -EFAULT; |
452 | 452 | ||
453 | err |= ia32_setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]); | 453 | err |= ia32_setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]); |
454 | if (err) | 454 | if (err) |
455 | goto give_sigsegv; | 455 | return -EFAULT; |
456 | 456 | ||
457 | if (_COMPAT_NSIG_WORDS > 1) { | 457 | if (_COMPAT_NSIG_WORDS > 1) { |
458 | err |= __copy_to_user(frame->extramask, &set->sig[1], | 458 | err |= __copy_to_user(frame->extramask, &set->sig[1], |
459 | sizeof(frame->extramask)); | 459 | sizeof(frame->extramask)); |
460 | if (err) | 460 | if (err) |
461 | goto give_sigsegv; | 461 | return -EFAULT; |
462 | } | 462 | } |
463 | 463 | ||
464 | if (ka->sa.sa_flags & SA_RESTORER) { | 464 | if (ka->sa.sa_flags & SA_RESTORER) { |
@@ -479,7 +479,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
479 | */ | 479 | */ |
480 | err |= __copy_to_user(frame->retcode, &code, 8); | 480 | err |= __copy_to_user(frame->retcode, &code, 8); |
481 | if (err) | 481 | if (err) |
482 | goto give_sigsegv; | 482 | return -EFAULT; |
483 | 483 | ||
484 | /* Set up registers for signal handler */ | 484 | /* Set up registers for signal handler */ |
485 | regs->sp = (unsigned long) frame; | 485 | regs->sp = (unsigned long) frame; |
@@ -502,10 +502,6 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
502 | #endif | 502 | #endif |
503 | 503 | ||
504 | return 0; | 504 | return 0; |
505 | |||
506 | give_sigsegv: | ||
507 | force_sigsegv(sig, current); | ||
508 | return -EFAULT; | ||
509 | } | 505 | } |
510 | 506 | ||
511 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 507 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
@@ -533,14 +529,14 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
533 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 529 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
534 | 530 | ||
535 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 531 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
536 | goto give_sigsegv; | 532 | return -EFAULT; |
537 | 533 | ||
538 | err |= __put_user(sig, &frame->sig); | 534 | err |= __put_user(sig, &frame->sig); |
539 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); | 535 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); |
540 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); | 536 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); |
541 | err |= copy_siginfo_to_user32(&frame->info, info); | 537 | err |= copy_siginfo_to_user32(&frame->info, info); |
542 | if (err) | 538 | if (err) |
543 | goto give_sigsegv; | 539 | return -EFAULT; |
544 | 540 | ||
545 | /* Create the ucontext. */ | 541 | /* Create the ucontext. */ |
546 | if (cpu_has_xsave) | 542 | if (cpu_has_xsave) |
@@ -556,7 +552,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
556 | regs, set->sig[0]); | 552 | regs, set->sig[0]); |
557 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 553 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
558 | if (err) | 554 | if (err) |
559 | goto give_sigsegv; | 555 | return -EFAULT; |
560 | 556 | ||
561 | if (ka->sa.sa_flags & SA_RESTORER) | 557 | if (ka->sa.sa_flags & SA_RESTORER) |
562 | restorer = ka->sa.sa_restorer; | 558 | restorer = ka->sa.sa_restorer; |
@@ -571,7 +567,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
571 | */ | 567 | */ |
572 | err |= __copy_to_user(frame->retcode, &code, 8); | 568 | err |= __copy_to_user(frame->retcode, &code, 8); |
573 | if (err) | 569 | if (err) |
574 | goto give_sigsegv; | 570 | return -EFAULT; |
575 | 571 | ||
576 | /* Set up registers for signal handler */ | 572 | /* Set up registers for signal handler */ |
577 | regs->sp = (unsigned long) frame; | 573 | regs->sp = (unsigned long) frame; |
@@ -599,8 +595,4 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
599 | #endif | 595 | #endif |
600 | 596 | ||
601 | return 0; | 597 | return 0; |
602 | |||
603 | give_sigsegv: | ||
604 | force_sigsegv(sig, current); | ||
605 | return -EFAULT; | ||
606 | } | 598 | } |