2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
5 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
6 * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes
7 * 2000-2002 x86-64 support by Andi Kleen
10 #include <linux/sched.h>
12 #include <linux/smp.h>
13 #include <linux/kernel.h>
14 #include <linux/signal.h>
15 #include <linux/errno.h>
16 #include <linux/wait.h>
17 #include <linux/ptrace.h>
18 #include <linux/tracehook.h>
19 #include <linux/unistd.h>
20 #include <linux/stddef.h>
21 #include <linux/personality.h>
22 #include <linux/uaccess.h>
24 #include <asm/processor.h>
25 #include <asm/ucontext.h>
30 #include <asm/proto.h>
31 #include <asm/ia32_unistd.h>
33 #endif /* CONFIG_X86_64 */
35 #include <asm/syscall.h>
36 #include <asm/syscalls.h>
40 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
42 #define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \
43 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
44 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
48 # define FIX_EFLAGS (__FIX_EFLAGS | X86_EFLAGS_RF)
50 # define FIX_EFLAGS __FIX_EFLAGS
54 err |= __get_user(regs->x, &sc->x); \
57 #define COPY_SEG(seg) { \
59 err |= __get_user(tmp, &sc->seg); \
63 #define COPY_SEG_CPL3(seg) { \
65 err |= __get_user(tmp, &sc->seg); \
66 regs->seg = tmp | 3; \
69 #define GET_SEG(seg) { \
71 err |= __get_user(tmp, &sc->seg); \
72 loadsegment(seg, tmp); \
76 restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
80 unsigned int tmpflags;
83 /* Always make any pending restarted system calls return -EINTR */
84 current_thread_info()->restart_block.fn = do_no_restart_syscall;
91 #endif /* CONFIG_X86_32 */
93 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
94 COPY(dx); COPY(cx); COPY(ip);
105 #endif /* CONFIG_X86_64 */
110 #else /* !CONFIG_X86_32 */
111 /* Kernel saves and restores only the CS segment register on signals,
112 * which is the bare minimum needed to allow mixed 32/64-bit code.
113 * App's signal handler can save/restore other segments if needed. */
115 #endif /* CONFIG_X86_32 */
117 err |= __get_user(tmpflags, &sc->flags);
118 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
119 regs->orig_ax = -1; /* disable syscall checks */
121 err |= __get_user(buf, &sc->fpstate);
122 err |= restore_i387_xstate(buf);
124 err |= __get_user(*pax, &sc->ax);
129 setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
130 struct pt_regs *regs, unsigned long mask)
138 savesegment(gs, tmp);
139 err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
141 err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs);
142 err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
143 err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
144 #endif /* CONFIG_X86_32 */
146 err |= __put_user(regs->di, &sc->di);
147 err |= __put_user(regs->si, &sc->si);
148 err |= __put_user(regs->bp, &sc->bp);
149 err |= __put_user(regs->sp, &sc->sp);
150 err |= __put_user(regs->bx, &sc->bx);
151 err |= __put_user(regs->dx, &sc->dx);
152 err |= __put_user(regs->cx, &sc->cx);
153 err |= __put_user(regs->ax, &sc->ax);
155 err |= __put_user(regs->r8, &sc->r8);
156 err |= __put_user(regs->r9, &sc->r9);
157 err |= __put_user(regs->r10, &sc->r10);
158 err |= __put_user(regs->r11, &sc->r11);
159 err |= __put_user(regs->r12, &sc->r12);
160 err |= __put_user(regs->r13, &sc->r13);
161 err |= __put_user(regs->r14, &sc->r14);
162 err |= __put_user(regs->r15, &sc->r15);
163 #endif /* CONFIG_X86_64 */
165 err |= __put_user(current->thread.trap_no, &sc->trapno);
166 err |= __put_user(current->thread.error_code, &sc->err);
167 err |= __put_user(regs->ip, &sc->ip);
169 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
170 err |= __put_user(regs->flags, &sc->flags);
171 err |= __put_user(regs->sp, &sc->sp_at_signal);
172 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
173 #else /* !CONFIG_X86_32 */
174 err |= __put_user(regs->flags, &sc->flags);
175 err |= __put_user(regs->cs, &sc->cs);
176 err |= __put_user(0, &sc->gs);
177 err |= __put_user(0, &sc->fs);
178 #endif /* CONFIG_X86_32 */
180 err |= __put_user(fpstate, &sc->fpstate);
182 /* non-iBCS2 extensions.. */
183 err |= __put_user(mask, &sc->oldmask);
184 err |= __put_user(current->thread.cr2, &sc->cr2);
190 * Set up a signal frame.
193 static const struct {
197 } __attribute__((packed)) retcode = {
198 0xb858, /* popl %eax; movl $..., %eax */
200 0x80cd, /* int $0x80 */
203 static const struct {
208 } __attribute__((packed)) rt_retcode = {
209 0xb8, /* movl $..., %eax */
211 0x80cd, /* int $0x80 */
216 * Determine which stack to use..
218 static inline void __user *
219 get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
224 /* Default to using normal stack */
228 * If we are on the alternate signal stack and would overflow it, don't.
229 * Return an always-bogus address instead so we will die with SIGSEGV.
231 if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size)))
232 return (void __user *) -1L;
234 /* This is the X/Open sanctioned signal stack switching. */
235 if (ka->sa.sa_flags & SA_ONSTACK) {
236 if (sas_ss_flags(sp) == 0)
237 sp = current->sas_ss_sp + current->sas_ss_size;
239 /* This is the legacy signal stack switching. */
240 if ((regs->ss & 0xffff) != __USER_DS &&
241 !(ka->sa.sa_flags & SA_RESTORER) &&
243 sp = (unsigned long) ka->sa.sa_restorer;
247 sp = sp - sig_xstate_size;
248 *fpstate = (struct _fpstate *) sp;
249 if (save_i387_xstate(*fpstate) < 0)
250 return (void __user *)-1L;
255 * Align the stack pointer according to the i386 ABI,
256 * i.e. so that on function entry ((sp + 4) & 15) == 0.
258 sp = ((sp + 4) & -16ul) - 4;
260 return (void __user *) sp;
264 __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
265 struct pt_regs *regs)
267 struct sigframe __user *frame;
268 void __user *restorer;
270 void __user *fpstate = NULL;
272 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
274 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
277 if (__put_user(sig, &frame->sig))
280 if (setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]))
283 if (_NSIG_WORDS > 1) {
284 if (__copy_to_user(&frame->extramask, &set->sig[1],
285 sizeof(frame->extramask)))
289 if (current->mm->context.vdso)
290 restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
292 restorer = &frame->retcode;
293 if (ka->sa.sa_flags & SA_RESTORER)
294 restorer = ka->sa.sa_restorer;
296 /* Set up to return from userspace. */
297 err |= __put_user(restorer, &frame->pretcode);
300 * This is popl %eax ; movl $__NR_sigreturn, %eax ; int $0x80
302 * WE DO NOT USE IT ANY MORE! It's only left here for historical
303 * reasons and because gdb uses it as a signature to notice
304 * signal handler stack frames.
306 err |= __put_user(*((u64 *)&retcode), (u64 *)frame->retcode);
311 /* Set up registers for signal handler */
312 regs->sp = (unsigned long)frame;
313 regs->ip = (unsigned long)ka->sa.sa_handler;
314 regs->ax = (unsigned long)sig;
318 regs->ds = __USER_DS;
319 regs->es = __USER_DS;
320 regs->ss = __USER_DS;
321 regs->cs = __USER_CS;
326 static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
327 sigset_t *set, struct pt_regs *regs)
329 struct rt_sigframe __user *frame;
330 void __user *restorer;
332 void __user *fpstate = NULL;
334 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
336 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
339 err |= __put_user(sig, &frame->sig);
340 err |= __put_user(&frame->info, &frame->pinfo);
341 err |= __put_user(&frame->uc, &frame->puc);
342 err |= copy_siginfo_to_user(&frame->info, info);
346 /* Create the ucontext. */
348 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
350 err |= __put_user(0, &frame->uc.uc_flags);
351 err |= __put_user(0, &frame->uc.uc_link);
352 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
353 err |= __put_user(sas_ss_flags(regs->sp),
354 &frame->uc.uc_stack.ss_flags);
355 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
356 err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
358 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
362 /* Set up to return from userspace. */
363 restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn);
364 if (ka->sa.sa_flags & SA_RESTORER)
365 restorer = ka->sa.sa_restorer;
366 err |= __put_user(restorer, &frame->pretcode);
369 * This is movl $__NR_rt_sigreturn, %ax ; int $0x80
371 * WE DO NOT USE IT ANY MORE! It's only left here for historical
372 * reasons and because gdb uses it as a signature to notice
373 * signal handler stack frames.
375 err |= __put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode);
380 /* Set up registers for signal handler */
381 regs->sp = (unsigned long)frame;
382 regs->ip = (unsigned long)ka->sa.sa_handler;
383 regs->ax = (unsigned long)sig;
384 regs->dx = (unsigned long)&frame->info;
385 regs->cx = (unsigned long)&frame->uc;
387 regs->ds = __USER_DS;
388 regs->es = __USER_DS;
389 regs->ss = __USER_DS;
390 regs->cs = __USER_CS;
394 #else /* !CONFIG_X86_32 */
396 * Determine which stack to use..
399 get_stack(struct k_sigaction *ka, unsigned long sp, unsigned long size)
401 /* Default to using normal stack - redzone*/
404 /* This is the X/Open sanctioned signal stack switching. */
405 if (ka->sa.sa_flags & SA_ONSTACK) {
406 if (sas_ss_flags(sp) == 0)
407 sp = current->sas_ss_sp + current->sas_ss_size;
410 return (void __user *)round_down(sp - size, 64);
413 static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
414 sigset_t *set, struct pt_regs *regs)
416 struct rt_sigframe __user *frame;
417 void __user *fp = NULL;
419 struct task_struct *me = current;
422 fp = get_stack(ka, regs->sp, sig_xstate_size);
423 frame = (void __user *)round_down(
424 (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
426 if (save_i387_xstate(fp) < 0)
429 frame = get_stack(ka, regs->sp, sizeof(struct rt_sigframe)) - 8;
431 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
434 if (ka->sa.sa_flags & SA_SIGINFO) {
435 if (copy_siginfo_to_user(&frame->info, info))
439 /* Create the ucontext. */
441 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
443 err |= __put_user(0, &frame->uc.uc_flags);
444 err |= __put_user(0, &frame->uc.uc_link);
445 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
446 err |= __put_user(sas_ss_flags(regs->sp),
447 &frame->uc.uc_stack.ss_flags);
448 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
449 err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]);
450 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
452 /* Set up to return from userspace. If provided, use a stub
453 already in userspace. */
454 /* x86-64 should always use SA_RESTORER. */
455 if (ka->sa.sa_flags & SA_RESTORER) {
456 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
458 /* could use a vstub here */
465 /* Set up registers for signal handler */
467 /* In case the signal handler was declared without prototypes */
470 /* This also works for non SA_SIGINFO handlers because they expect the
471 next argument after the signal number on the stack. */
472 regs->si = (unsigned long)&frame->info;
473 regs->dx = (unsigned long)&frame->uc;
474 regs->ip = (unsigned long) ka->sa.sa_handler;
476 regs->sp = (unsigned long)frame;
478 /* Set up the CS register to run signal handlers in 64-bit mode,
479 even if the handler happens to be interrupting 32-bit code. */
480 regs->cs = __USER_CS;
484 #endif /* CONFIG_X86_32 */
488 * Atomically swap in the new signal mask, and wait for a signal.
491 sys_sigsuspend(int history0, int history1, old_sigset_t mask)
494 spin_lock_irq(¤t->sighand->siglock);
495 current->saved_sigmask = current->blocked;
496 siginitset(¤t->blocked, mask);
498 spin_unlock_irq(¤t->sighand->siglock);
500 current->state = TASK_INTERRUPTIBLE;
502 set_restore_sigmask();
504 return -ERESTARTNOHAND;
508 sys_sigaction(int sig, const struct old_sigaction __user *act,
509 struct old_sigaction __user *oact)
511 struct k_sigaction new_ka, old_ka;
517 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
518 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
519 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
522 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
523 __get_user(mask, &act->sa_mask);
524 siginitset(&new_ka.sa.sa_mask, mask);
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
530 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
531 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
532 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
535 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
536 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
541 #endif /* CONFIG_X86_32 */
544 asmlinkage int sys_sigaltstack(unsigned long bx)
547 * This is needed to make gcc realize it doesn't own the
550 struct pt_regs *regs = (struct pt_regs *)&bx;
551 const stack_t __user *uss = (const stack_t __user *)bx;
552 stack_t __user *uoss = (stack_t __user *)regs->cx;
554 return do_sigaltstack(uss, uoss, regs->sp);
556 #else /* !CONFIG_X86_32 */
558 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
559 struct pt_regs *regs)
561 return do_sigaltstack(uss, uoss, regs->sp);
563 #endif /* CONFIG_X86_32 */
566 * Do a signal return; undo the signal stack.
569 asmlinkage unsigned long sys_sigreturn(unsigned long __unused)
571 struct sigframe __user *frame;
572 struct pt_regs *regs;
576 regs = (struct pt_regs *) &__unused;
577 frame = (struct sigframe __user *)(regs->sp - 8);
579 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
581 if (__get_user(set.sig[0], &frame->sc.oldmask) || (_NSIG_WORDS > 1
582 && __copy_from_user(&set.sig[1], &frame->extramask,
583 sizeof(frame->extramask))))
586 sigdelsetmask(&set, ~_BLOCKABLE);
587 spin_lock_irq(¤t->sighand->siglock);
588 current->blocked = set;
590 spin_unlock_irq(¤t->sighand->siglock);
592 if (restore_sigcontext(regs, &frame->sc, &ax))
597 signal_fault(regs, frame, "sigreturn");
601 #endif /* CONFIG_X86_32 */
603 static long do_rt_sigreturn(struct pt_regs *regs)
605 struct rt_sigframe __user *frame;
609 frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
610 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
612 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
615 sigdelsetmask(&set, ~_BLOCKABLE);
616 spin_lock_irq(¤t->sighand->siglock);
617 current->blocked = set;
619 spin_unlock_irq(¤t->sighand->siglock);
621 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
624 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
630 signal_fault(regs, frame, "rt_sigreturn");
635 asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
637 return do_rt_sigreturn(®s);
639 #else /* !CONFIG_X86_32 */
640 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
642 return do_rt_sigreturn(regs);
644 #endif /* CONFIG_X86_32 */
647 * OK, we're invoking a handler:
649 static int signr_convert(int sig)
652 struct thread_info *info = current_thread_info();
654 if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32)
655 return info->exec_domain->signal_invmap[sig];
656 #endif /* CONFIG_X86_32 */
663 #define ia32_setup_frame __setup_frame
664 #define ia32_setup_rt_frame __setup_rt_frame
666 #else /* !CONFIG_X86_32 */
668 #ifdef CONFIG_IA32_EMULATION
669 #define is_ia32 test_thread_flag(TIF_IA32)
670 #else /* !CONFIG_IA32_EMULATION */
672 #endif /* CONFIG_IA32_EMULATION */
674 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
675 sigset_t *set, struct pt_regs *regs);
676 int ia32_setup_frame(int sig, struct k_sigaction *ka,
677 sigset_t *set, struct pt_regs *regs);
679 #endif /* CONFIG_X86_32 */
682 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
683 sigset_t *set, struct pt_regs *regs)
685 int usig = signr_convert(sig);
688 /* Set up the stack frame */
690 if (ka->sa.sa_flags & SA_SIGINFO)
691 ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
693 ret = ia32_setup_frame(usig, ka, set, regs);
695 ret = __setup_rt_frame(sig, ka, info, set, regs);
698 force_sigsegv(sig, current);
706 handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
707 sigset_t *oldset, struct pt_regs *regs)
711 /* Are we from a system call? */
712 if (syscall_get_nr(current, regs) >= 0) {
713 /* If so, check system call restarting.. */
714 switch (syscall_get_error(current, regs)) {
715 case -ERESTART_RESTARTBLOCK:
716 case -ERESTARTNOHAND:
721 if (!(ka->sa.sa_flags & SA_RESTART)) {
726 case -ERESTARTNOINTR:
727 regs->ax = regs->orig_ax;
734 * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF
735 * flag so that register information in the sigcontext is correct.
737 if (unlikely(regs->flags & X86_EFLAGS_TF) &&
738 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
739 regs->flags &= ~X86_EFLAGS_TF;
741 ret = setup_rt_frame(sig, ka, info, oldset, regs);
748 * This has nothing to do with segment registers,
749 * despite the name. This magic affects uaccess.h
750 * macros' behavior. Reset it to the normal setting.
756 * Clear the direction flag as per the ABI for function entry.
758 regs->flags &= ~X86_EFLAGS_DF;
761 * Clear TF when entering the signal handler, but
762 * notify any tracer that was single-stepping it.
763 * The tracer may want to single-step inside the
766 regs->flags &= ~X86_EFLAGS_TF;
768 spin_lock_irq(¤t->sighand->siglock);
769 sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask);
770 if (!(ka->sa.sa_flags & SA_NODEFER))
771 sigaddset(¤t->blocked, sig);
773 spin_unlock_irq(¤t->sighand->siglock);
775 tracehook_signal_handler(sig, info, ka, regs,
776 test_thread_flag(TIF_SINGLESTEP));
782 #define NR_restart_syscall __NR_restart_syscall
783 #else /* !CONFIG_X86_32 */
784 #define NR_restart_syscall \
785 test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
786 #endif /* CONFIG_X86_32 */
789 * Note that 'init' is a special process: it doesn't get signals it doesn't
790 * want to handle. Thus you cannot kill init even with a SIGKILL even by
793 static void do_signal(struct pt_regs *regs)
795 struct k_sigaction ka;
801 * We want the common case to go fast, which is why we may in certain
802 * cases get here from kernel mode. Just return without doing anything
804 * X86_32: vm86 regs switched out by assembly code before reaching
805 * here, so testing against kernel CS suffices.
807 if (!user_mode(regs))
810 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
811 oldset = ¤t->saved_sigmask;
813 oldset = ¤t->blocked;
815 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
818 * Re-enable any watchpoints before delivering the
819 * signal to user space. The processor register will
820 * have been cleared if the watchpoint triggered
823 if (current->thread.debugreg7)
824 set_debugreg(current->thread.debugreg7, 7);
826 /* Whee! Actually deliver the signal. */
827 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
829 * A signal was successfully delivered; the saved
830 * sigmask will have been stored in the signal frame,
831 * and will be restored by sigreturn, so we can simply
832 * clear the TS_RESTORE_SIGMASK flag.
834 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
839 /* Did we come from a system call? */
840 if (syscall_get_nr(current, regs) >= 0) {
841 /* Restart the system call - no handlers present */
842 switch (syscall_get_error(current, regs)) {
843 case -ERESTARTNOHAND:
845 case -ERESTARTNOINTR:
846 regs->ax = regs->orig_ax;
850 case -ERESTART_RESTARTBLOCK:
851 regs->ax = NR_restart_syscall;
858 * If there's no signal to deliver, we just put the saved sigmask
861 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
862 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
863 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL);
868 * notification of userspace execution resumption
869 * - triggered by the TIF_WORK_MASK flags
872 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
874 #if defined(CONFIG_X86_64) && defined(CONFIG_X86_MCE)
875 /* notify userspace of pending MCEs */
876 if (thread_info_flags & _TIF_MCE_NOTIFY)
878 #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */
880 /* deal with pending signal delivery */
881 if (thread_info_flags & _TIF_SIGPENDING)
884 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
885 clear_thread_flag(TIF_NOTIFY_RESUME);
886 tracehook_notify_resume(regs);
890 clear_thread_flag(TIF_IRET);
891 #endif /* CONFIG_X86_32 */
894 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
896 struct task_struct *me = current;
898 if (show_unhandled_signals && printk_ratelimit()) {
900 "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
901 task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
902 me->comm, me->pid, where, frame,
903 regs->ip, regs->sp, regs->orig_ax);
904 print_vma_addr(" in ", regs->ip);
905 printk(KERN_CONT "\n");
908 force_sig(SIGSEGV, me);