diff options
Diffstat (limited to 'arch/mips/kernel/signal32.c')
-rw-r--r-- | arch/mips/kernel/signal32.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index bae2e6ee2109..d69179c0d49d 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -490,21 +490,21 @@ badframe: | |||
490 | force_sig(SIGSEGV, current); | 490 | force_sig(SIGSEGV, current); |
491 | } | 491 | } |
492 | 492 | ||
493 | static int setup_frame_32(void *sig_return, struct k_sigaction *ka, | 493 | static int setup_frame_32(void *sig_return, struct ksignal *ksig, |
494 | struct pt_regs *regs, int signr, sigset_t *set) | 494 | struct pt_regs *regs, sigset_t *set) |
495 | { | 495 | { |
496 | struct sigframe32 __user *frame; | 496 | struct sigframe32 __user *frame; |
497 | int err = 0; | 497 | int err = 0; |
498 | 498 | ||
499 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 499 | frame = get_sigframe(ksig, regs, sizeof(*frame)); |
500 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) | 500 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) |
501 | goto give_sigsegv; | 501 | return -EFAULT; |
502 | 502 | ||
503 | err |= setup_sigcontext32(regs, &frame->sf_sc); | 503 | err |= setup_sigcontext32(regs, &frame->sf_sc); |
504 | err |= __copy_conv_sigset_to_user(&frame->sf_mask, set); | 504 | err |= __copy_conv_sigset_to_user(&frame->sf_mask, set); |
505 | 505 | ||
506 | if (err) | 506 | if (err) |
507 | goto give_sigsegv; | 507 | return -EFAULT; |
508 | 508 | ||
509 | /* | 509 | /* |
510 | * Arguments to signal handler: | 510 | * Arguments to signal handler: |
@@ -516,37 +516,32 @@ static int setup_frame_32(void *sig_return, struct k_sigaction *ka, | |||
516 | * $25 and c0_epc point to the signal handler, $29 points to the | 516 | * $25 and c0_epc point to the signal handler, $29 points to the |
517 | * struct sigframe. | 517 | * struct sigframe. |
518 | */ | 518 | */ |
519 | regs->regs[ 4] = signr; | 519 | regs->regs[ 4] = ksig->sig; |
520 | regs->regs[ 5] = 0; | 520 | regs->regs[ 5] = 0; |
521 | regs->regs[ 6] = (unsigned long) &frame->sf_sc; | 521 | regs->regs[ 6] = (unsigned long) &frame->sf_sc; |
522 | regs->regs[29] = (unsigned long) frame; | 522 | regs->regs[29] = (unsigned long) frame; |
523 | regs->regs[31] = (unsigned long) sig_return; | 523 | regs->regs[31] = (unsigned long) sig_return; |
524 | regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; | 524 | regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler; |
525 | 525 | ||
526 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", | 526 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", |
527 | current->comm, current->pid, | 527 | current->comm, current->pid, |
528 | frame, regs->cp0_epc, regs->regs[31]); | 528 | frame, regs->cp0_epc, regs->regs[31]); |
529 | 529 | ||
530 | return 0; | 530 | return 0; |
531 | |||
532 | give_sigsegv: | ||
533 | force_sigsegv(signr, current); | ||
534 | return -EFAULT; | ||
535 | } | 531 | } |
536 | 532 | ||
537 | static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka, | 533 | static int setup_rt_frame_32(void *sig_return, struct ksignal *ksig, |
538 | struct pt_regs *regs, int signr, sigset_t *set, | 534 | struct pt_regs *regs, sigset_t *set) |
539 | siginfo_t *info) | ||
540 | { | 535 | { |
541 | struct rt_sigframe32 __user *frame; | 536 | struct rt_sigframe32 __user *frame; |
542 | int err = 0; | 537 | int err = 0; |
543 | 538 | ||
544 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 539 | frame = get_sigframe(ksig, regs, sizeof(*frame)); |
545 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) | 540 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) |
546 | goto give_sigsegv; | 541 | return -EFAULT; |
547 | 542 | ||
548 | /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */ | 543 | /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */ |
549 | err |= copy_siginfo_to_user32(&frame->rs_info, info); | 544 | err |= copy_siginfo_to_user32(&frame->rs_info, &ksig->info); |
550 | 545 | ||
551 | /* Create the ucontext. */ | 546 | /* Create the ucontext. */ |
552 | err |= __put_user(0, &frame->rs_uc.uc_flags); | 547 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
@@ -556,7 +551,7 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka, | |||
556 | err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); | 551 | err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); |
557 | 552 | ||
558 | if (err) | 553 | if (err) |
559 | goto give_sigsegv; | 554 | return -EFAULT; |
560 | 555 | ||
561 | /* | 556 | /* |
562 | * Arguments to signal handler: | 557 | * Arguments to signal handler: |
@@ -568,22 +563,18 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka, | |||
568 | * $25 and c0_epc point to the signal handler, $29 points to | 563 | * $25 and c0_epc point to the signal handler, $29 points to |
569 | * the struct rt_sigframe32. | 564 | * the struct rt_sigframe32. |
570 | */ | 565 | */ |
571 | regs->regs[ 4] = signr; | 566 | regs->regs[ 4] = ksig->sig; |
572 | regs->regs[ 5] = (unsigned long) &frame->rs_info; | 567 | regs->regs[ 5] = (unsigned long) &frame->rs_info; |
573 | regs->regs[ 6] = (unsigned long) &frame->rs_uc; | 568 | regs->regs[ 6] = (unsigned long) &frame->rs_uc; |
574 | regs->regs[29] = (unsigned long) frame; | 569 | regs->regs[29] = (unsigned long) frame; |
575 | regs->regs[31] = (unsigned long) sig_return; | 570 | regs->regs[31] = (unsigned long) sig_return; |
576 | regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; | 571 | regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler; |
577 | 572 | ||
578 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", | 573 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", |
579 | current->comm, current->pid, | 574 | current->comm, current->pid, |
580 | frame, regs->cp0_epc, regs->regs[31]); | 575 | frame, regs->cp0_epc, regs->regs[31]); |
581 | 576 | ||
582 | return 0; | 577 | return 0; |
583 | |||
584 | give_sigsegv: | ||
585 | force_sigsegv(signr, current); | ||
586 | return -EFAULT; | ||
587 | } | 578 | } |
588 | 579 | ||
589 | /* | 580 | /* |