aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/um/signal.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 12:01:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 12:01:41 -0400
commit3a8580f82024e30b31c662aa49346adf7a3bcdb5 (patch)
tree7769a01f152b4081f4e4225e499082fd5c67b184 /arch/x86/um/signal.c
parent1d767cae4dbd4116fc3b2cc3251a20760f98339f (diff)
parent2ccf62b36097aa88e0ea152d6ef0c0ca2d3884e6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML updates from Richard Weinberger: "Most changes are bug fixes and cleanups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: missing checks of __put_user()/__get_user() return values um: stub_rt_sigsuspend isn't needed these days anymore um/x86: merge (and trim) 32- and 64-bit variants of ptrace.h irq: Remove irq_chip->release() um: Remove CONFIG_IRQ_RELEASE_METHOD um: Remove usage of irq_chip->release() um: Implement um_free_irq() um: Fix __swp_type() um: Implement a custom pte_same() function um: Add BUG() to do_ops()'s error path um: Remove unused variables um: bury unused _TIF_RESTORE_SIGMASK um: wrong sigmask saved in case of multiple sigframes um: add TIF_NOTIFY_RESUME um: ->restart_block.fn needs to be reset on sigreturn
Diffstat (limited to 'arch/x86/um/signal.c')
-rw-r--r--arch/x86/um/signal.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index 4883b9546016..bb0fb03b9f85 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -156,6 +156,9 @@ static int copy_sc_from_user(struct pt_regs *regs,
156 struct sigcontext sc; 156 struct sigcontext sc;
157 int err, pid; 157 int err, pid;
158 158
159 /* Always make any pending restarted system calls return -EINTR */
160 current_thread_info()->restart_block.fn = do_no_restart_syscall;
161
159 err = copy_from_user(&sc, from, sizeof(sc)); 162 err = copy_from_user(&sc, from, sizeof(sc));
160 if (err) 163 if (err)
161 return err; 164 return err;
@@ -410,9 +413,9 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
410 413
411 PT_REGS_SP(regs) = (unsigned long) frame; 414 PT_REGS_SP(regs) = (unsigned long) frame;
412 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 415 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
413 PT_REGS_EAX(regs) = (unsigned long) sig; 416 PT_REGS_AX(regs) = (unsigned long) sig;
414 PT_REGS_EDX(regs) = (unsigned long) 0; 417 PT_REGS_DX(regs) = (unsigned long) 0;
415 PT_REGS_ECX(regs) = (unsigned long) 0; 418 PT_REGS_CX(regs) = (unsigned long) 0;
416 419
417 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 420 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
418 ptrace_notify(SIGTRAP); 421 ptrace_notify(SIGTRAP);
@@ -460,9 +463,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
460 463
461 PT_REGS_SP(regs) = (unsigned long) frame; 464 PT_REGS_SP(regs) = (unsigned long) frame;
462 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 465 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
463 PT_REGS_EAX(regs) = (unsigned long) sig; 466 PT_REGS_AX(regs) = (unsigned long) sig;
464 PT_REGS_EDX(regs) = (unsigned long) &frame->info; 467 PT_REGS_DX(regs) = (unsigned long) &frame->info;
465 PT_REGS_ECX(regs) = (unsigned long) &frame->uc; 468 PT_REGS_CX(regs) = (unsigned long) &frame->uc;
466 469
467 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 470 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
468 ptrace_notify(SIGTRAP); 471 ptrace_notify(SIGTRAP);
@@ -541,8 +544,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
541 set->sig[0]); 544 set->sig[0]);
542 err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate); 545 err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
543 if (sizeof(*set) == 16) { 546 if (sizeof(*set) == 16) {
544 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); 547 err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
545 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); 548 err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
546 } 549 }
547 else 550 else
548 err |= __copy_to_user(&frame->uc.uc_sigmask, set, 551 err |= __copy_to_user(&frame->uc.uc_sigmask, set,
@@ -570,17 +573,17 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
570 } 573 }
571 574
572 PT_REGS_SP(regs) = (unsigned long) frame; 575 PT_REGS_SP(regs) = (unsigned long) frame;
573 PT_REGS_RDI(regs) = sig; 576 PT_REGS_DI(regs) = sig;
574 /* In case the signal handler was declared without prototypes */ 577 /* In case the signal handler was declared without prototypes */
575 PT_REGS_RAX(regs) = 0; 578 PT_REGS_AX(regs) = 0;
576 579
577 /* 580 /*
578 * This also works for non SA_SIGINFO handlers because they expect the 581 * This also works for non SA_SIGINFO handlers because they expect the
579 * next argument after the signal number on the stack. 582 * next argument after the signal number on the stack.
580 */ 583 */
581 PT_REGS_RSI(regs) = (unsigned long) &frame->info; 584 PT_REGS_SI(regs) = (unsigned long) &frame->info;
582 PT_REGS_RDX(regs) = (unsigned long) &frame->uc; 585 PT_REGS_DX(regs) = (unsigned long) &frame->uc;
583 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; 586 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
584 out: 587 out:
585 return err; 588 return err;
586} 589}