aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/signal32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/signal32.c')
-rw-r--r--arch/arm64/kernel/signal32.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index c5ee208321c3..1b9ad02837cf 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -407,20 +407,14 @@ badframe:
407 return 0; 407 return 0;
408} 408}
409 409
410static void __user *compat_get_sigframe(struct k_sigaction *ka, 410static void __user *compat_get_sigframe(struct ksignal *ksig,
411 struct pt_regs *regs, 411 struct pt_regs *regs,
412 int framesize) 412 int framesize)
413{ 413{
414 compat_ulong_t sp = regs->compat_sp; 414 compat_ulong_t sp = sigsp(regs->compat_sp, ksig);
415 void __user *frame; 415 void __user *frame;
416 416
417 /* 417 /*
418 * This is the X/Open sanctioned signal stack switching.
419 */
420 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
421 sp = current->sas_ss_sp + current->sas_ss_size;
422
423 /*
424 * ATPCS B01 mandates 8-byte alignment 418 * ATPCS B01 mandates 8-byte alignment
425 */ 419 */
426 frame = compat_ptr((compat_uptr_t)((sp - framesize) & ~7)); 420 frame = compat_ptr((compat_uptr_t)((sp - framesize) & ~7));
@@ -520,18 +514,18 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf,
520/* 514/*
521 * 32-bit signal handling routines called from signal.c 515 * 32-bit signal handling routines called from signal.c
522 */ 516 */
523int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 517int compat_setup_rt_frame(int usig, struct ksignal *ksig,
524 sigset_t *set, struct pt_regs *regs) 518 sigset_t *set, struct pt_regs *regs)
525{ 519{
526 struct compat_rt_sigframe __user *frame; 520 struct compat_rt_sigframe __user *frame;
527 int err = 0; 521 int err = 0;
528 522
529 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 523 frame = compat_get_sigframe(ksig, regs, sizeof(*frame));
530 524
531 if (!frame) 525 if (!frame)
532 return 1; 526 return 1;
533 527
534 err |= copy_siginfo_to_user32(&frame->info, info); 528 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
535 529
536 __put_user_error(0, &frame->sig.uc.uc_flags, err); 530 __put_user_error(0, &frame->sig.uc.uc_flags, err);
537 __put_user_error(0, &frame->sig.uc.uc_link, err); 531 __put_user_error(0, &frame->sig.uc.uc_link, err);
@@ -541,7 +535,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
541 err |= compat_setup_sigframe(&frame->sig, regs, set); 535 err |= compat_setup_sigframe(&frame->sig, regs, set);
542 536
543 if (err == 0) { 537 if (err == 0) {
544 compat_setup_return(regs, ka, frame->sig.retcode, frame, usig); 538 compat_setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
545 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info; 539 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info;
546 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc; 540 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc;
547 } 541 }
@@ -549,13 +543,13 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
549 return err; 543 return err;
550} 544}
551 545
552int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, 546int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
553 struct pt_regs *regs) 547 struct pt_regs *regs)
554{ 548{
555 struct compat_sigframe __user *frame; 549 struct compat_sigframe __user *frame;
556 int err = 0; 550 int err = 0;
557 551
558 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 552 frame = compat_get_sigframe(ksig, regs, sizeof(*frame));
559 553
560 if (!frame) 554 if (!frame)
561 return 1; 555 return 1;
@@ -564,7 +558,7 @@ int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set,
564 558
565 err |= compat_setup_sigframe(frame, regs, set); 559 err |= compat_setup_sigframe(frame, regs, set);
566 if (err == 0) 560 if (err == 0)
567 compat_setup_return(regs, ka, frame->retcode, frame, usig); 561 compat_setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
568 562
569 return err; 563 return err;
570} 564}