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>
38 #include <asm/sigframe.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
53 #define COPY(x) do { \
54 get_user_ex(regs->x, &sc->x); \
57 #define GET_SEG(seg) ({ \
59 get_user_ex(tmp, &sc->seg); \
63 #define COPY_SEG(seg) do { \
64 regs->seg = GET_SEG(seg); \
67 #define COPY_SEG_CPL3(seg) do { \
68 regs->seg = GET_SEG(seg) | 3; \
72 restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
76 unsigned int tmpflags;
79 /* Always make any pending restarted system calls return -EINTR */
80 current_thread_info()->restart_block.fn = do_no_restart_syscall;
85 set_user_gs(regs, GET_SEG(gs));
89 #endif /* CONFIG_X86_32 */
91 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
92 COPY(dx); COPY(cx); COPY(ip);
103 #endif /* CONFIG_X86_64 */
108 #else /* !CONFIG_X86_32 */
109 /* Kernel saves and restores only the CS segment register on signals,
110 * which is the bare minimum needed to allow mixed 32/64-bit code.
111 * App's signal handler can save/restore other segments if needed. */
113 #endif /* CONFIG_X86_32 */
115 get_user_ex(tmpflags, &sc->flags);
116 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
117 regs->orig_ax = -1; /* disable syscall checks */
119 get_user_ex(buf, &sc->fpstate);
120 err |= restore_i387_xstate(buf);
122 get_user_ex(*pax, &sc->ax);
123 } get_user_catch(err);
129 setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
130 struct pt_regs *regs, unsigned long mask)
137 put_user_ex(get_user_gs(regs), (unsigned int __user *)&sc->gs);
138 put_user_ex(regs->fs, (unsigned int __user *)&sc->fs);
139 put_user_ex(regs->es, (unsigned int __user *)&sc->es);
140 put_user_ex(regs->ds, (unsigned int __user *)&sc->ds);
141 #endif /* CONFIG_X86_32 */
143 put_user_ex(regs->di, &sc->di);
144 put_user_ex(regs->si, &sc->si);
145 put_user_ex(regs->bp, &sc->bp);
146 put_user_ex(regs->sp, &sc->sp);
147 put_user_ex(regs->bx, &sc->bx);
148 put_user_ex(regs->dx, &sc->dx);
149 put_user_ex(regs->cx, &sc->cx);
150 put_user_ex(regs->ax, &sc->ax);
152 put_user_ex(regs->r8, &sc->r8);
153 put_user_ex(regs->r9, &sc->r9);
154 put_user_ex(regs->r10, &sc->r10);
155 put_user_ex(regs->r11, &sc->r11);
156 put_user_ex(regs->r12, &sc->r12);
157 put_user_ex(regs->r13, &sc->r13);
158 put_user_ex(regs->r14, &sc->r14);
159 put_user_ex(regs->r15, &sc->r15);
160 #endif /* CONFIG_X86_64 */
162 put_user_ex(current->thread.trap_no, &sc->trapno);
163 put_user_ex(current->thread.error_code, &sc->err);
164 put_user_ex(regs->ip, &sc->ip);
166 put_user_ex(regs->cs, (unsigned int __user *)&sc->cs);
167 put_user_ex(regs->flags, &sc->flags);
168 put_user_ex(regs->sp, &sc->sp_at_signal);
169 put_user_ex(regs->ss, (unsigned int __user *)&sc->ss);
170 #else /* !CONFIG_X86_32 */
171 put_user_ex(regs->flags, &sc->flags);
172 put_user_ex(regs->cs, &sc->cs);
173 put_user_ex(0, &sc->gs);
174 put_user_ex(0, &sc->fs);
175 #endif /* CONFIG_X86_32 */
177 put_user_ex(fpstate, &sc->fpstate);
179 /* non-iBCS2 extensions.. */
180 put_user_ex(mask, &sc->oldmask);
181 put_user_ex(current->thread.cr2, &sc->cr2);
182 } put_user_catch(err);
188 * Set up a signal frame.
192 * Determine which stack to use..
194 static unsigned long align_sigframe(unsigned long sp)
198 * Align the stack pointer according to the i386 ABI,
199 * i.e. so that on function entry ((sp + 4) & 15) == 0.
201 sp = ((sp + 4) & -16ul) - 4;
202 #else /* !CONFIG_X86_32 */
203 sp = round_down(sp, 16) - 8;
208 static inline void __user *
209 get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
210 void __user **fpstate)
212 /* Default to using normal stack */
213 unsigned long sp = regs->sp;
214 int onsigstack = on_sig_stack(sp);
219 #endif /* CONFIG_X86_64 */
222 /* This is the X/Open sanctioned signal stack switching. */
223 if (ka->sa.sa_flags & SA_ONSTACK) {
224 if (current->sas_ss_size)
225 sp = current->sas_ss_sp + current->sas_ss_size;
228 /* This is the legacy signal stack switching. */
229 if ((regs->ss & 0xffff) != __USER_DS &&
230 !(ka->sa.sa_flags & SA_RESTORER) &&
232 sp = (unsigned long) ka->sa.sa_restorer;
233 #endif /* CONFIG_X86_32 */
238 sp -= sig_xstate_size;
240 sp = round_down(sp, 64);
241 #endif /* CONFIG_X86_64 */
242 *fpstate = (void __user *)sp;
245 sp = align_sigframe(sp - frame_size);
248 * If we are on the alternate signal stack and would overflow it, don't.
249 * Return an always-bogus address instead so we will die with SIGSEGV.
251 if (onsigstack && !likely(on_sig_stack(sp)))
252 return (void __user *)-1L;
254 /* save i387 state */
255 if (used_math() && save_i387_xstate(*fpstate) < 0)
256 return (void __user *)-1L;
258 return (void __user *)sp;
262 static const struct {
266 } __attribute__((packed)) retcode = {
267 0xb858, /* popl %eax; movl $..., %eax */
269 0x80cd, /* int $0x80 */
272 static const struct {
277 } __attribute__((packed)) rt_retcode = {
278 0xb8, /* movl $..., %eax */
280 0x80cd, /* int $0x80 */
285 __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
286 struct pt_regs *regs)
288 struct sigframe __user *frame;
289 void __user *restorer;
291 void __user *fpstate = NULL;
293 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
295 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
298 if (__put_user(sig, &frame->sig))
301 if (setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]))
304 if (_NSIG_WORDS > 1) {
305 if (__copy_to_user(&frame->extramask, &set->sig[1],
306 sizeof(frame->extramask)))
310 if (current->mm->context.vdso)
311 restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
313 restorer = &frame->retcode;
314 if (ka->sa.sa_flags & SA_RESTORER)
315 restorer = ka->sa.sa_restorer;
317 /* Set up to return from userspace. */
318 err |= __put_user(restorer, &frame->pretcode);
321 * This is popl %eax ; movl $__NR_sigreturn, %eax ; int $0x80
323 * WE DO NOT USE IT ANY MORE! It's only left here for historical
324 * reasons and because gdb uses it as a signature to notice
325 * signal handler stack frames.
327 err |= __put_user(*((u64 *)&retcode), (u64 *)frame->retcode);
332 /* Set up registers for signal handler */
333 regs->sp = (unsigned long)frame;
334 regs->ip = (unsigned long)ka->sa.sa_handler;
335 regs->ax = (unsigned long)sig;
339 regs->ds = __USER_DS;
340 regs->es = __USER_DS;
341 regs->ss = __USER_DS;
342 regs->cs = __USER_CS;
347 static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
348 sigset_t *set, struct pt_regs *regs)
350 struct rt_sigframe __user *frame;
351 void __user *restorer;
353 void __user *fpstate = NULL;
355 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
357 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
361 put_user_ex(sig, &frame->sig);
362 put_user_ex(&frame->info, &frame->pinfo);
363 put_user_ex(&frame->uc, &frame->puc);
364 err |= copy_siginfo_to_user(&frame->info, info);
366 /* Create the ucontext. */
368 put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags);
370 put_user_ex(0, &frame->uc.uc_flags);
371 put_user_ex(0, &frame->uc.uc_link);
372 put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
373 put_user_ex(sas_ss_flags(regs->sp),
374 &frame->uc.uc_stack.ss_flags);
375 put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
376 err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
378 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
380 /* Set up to return from userspace. */
381 restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn);
382 if (ka->sa.sa_flags & SA_RESTORER)
383 restorer = ka->sa.sa_restorer;
384 put_user_ex(restorer, &frame->pretcode);
387 * This is movl $__NR_rt_sigreturn, %ax ; int $0x80
389 * WE DO NOT USE IT ANY MORE! It's only left here for historical
390 * reasons and because gdb uses it as a signature to notice
391 * signal handler stack frames.
393 put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode);
394 } put_user_catch(err);
399 /* Set up registers for signal handler */
400 regs->sp = (unsigned long)frame;
401 regs->ip = (unsigned long)ka->sa.sa_handler;
402 regs->ax = (unsigned long)sig;
403 regs->dx = (unsigned long)&frame->info;
404 regs->cx = (unsigned long)&frame->uc;
406 regs->ds = __USER_DS;
407 regs->es = __USER_DS;
408 regs->ss = __USER_DS;
409 regs->cs = __USER_CS;
413 #else /* !CONFIG_X86_32 */
414 static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
415 sigset_t *set, struct pt_regs *regs)
417 struct rt_sigframe __user *frame;
418 void __user *fp = NULL;
420 struct task_struct *me = current;
422 frame = get_sigframe(ka, regs, sizeof(struct rt_sigframe), &fp);
424 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
427 if (ka->sa.sa_flags & SA_SIGINFO) {
428 if (copy_siginfo_to_user(&frame->info, info))
433 /* Create the ucontext. */
435 put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags);
437 put_user_ex(0, &frame->uc.uc_flags);
438 put_user_ex(0, &frame->uc.uc_link);
439 put_user_ex(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
440 put_user_ex(sas_ss_flags(regs->sp),
441 &frame->uc.uc_stack.ss_flags);
442 put_user_ex(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
443 err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]);
444 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
446 /* Set up to return from userspace. If provided, use a stub
447 already in userspace. */
448 /* x86-64 should always use SA_RESTORER. */
449 if (ka->sa.sa_flags & SA_RESTORER) {
450 put_user_ex(ka->sa.sa_restorer, &frame->pretcode);
452 /* could use a vstub here */
455 } put_user_catch(err);
460 /* Set up registers for signal handler */
462 /* In case the signal handler was declared without prototypes */
465 /* This also works for non SA_SIGINFO handlers because they expect the
466 next argument after the signal number on the stack. */
467 regs->si = (unsigned long)&frame->info;
468 regs->dx = (unsigned long)&frame->uc;
469 regs->ip = (unsigned long) ka->sa.sa_handler;
471 regs->sp = (unsigned long)frame;
473 /* Set up the CS register to run signal handlers in 64-bit mode,
474 even if the handler happens to be interrupting 32-bit code. */
475 regs->cs = __USER_CS;
479 #endif /* CONFIG_X86_32 */
483 * Atomically swap in the new signal mask, and wait for a signal.
486 sys_sigsuspend(int history0, int history1, old_sigset_t mask)
489 spin_lock_irq(¤t->sighand->siglock);
490 current->saved_sigmask = current->blocked;
491 siginitset(¤t->blocked, mask);
493 spin_unlock_irq(¤t->sighand->siglock);
495 current->state = TASK_INTERRUPTIBLE;
497 set_restore_sigmask();
499 return -ERESTARTNOHAND;
503 sys_sigaction(int sig, const struct old_sigaction __user *act,
504 struct old_sigaction __user *oact)
506 struct k_sigaction new_ka, old_ka;
512 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
516 get_user_ex(new_ka.sa.sa_handler, &act->sa_handler);
517 get_user_ex(new_ka.sa.sa_flags, &act->sa_flags);
518 get_user_ex(mask, &act->sa_mask);
519 get_user_ex(new_ka.sa.sa_restorer, &act->sa_restorer);
520 } get_user_catch(ret);
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)))
534 put_user_ex(old_ka.sa.sa_handler, &oact->sa_handler);
535 put_user_ex(old_ka.sa.sa_flags, &oact->sa_flags);
536 put_user_ex(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
537 put_user_ex(old_ka.sa.sa_restorer, &oact->sa_restorer);
538 } put_user_catch(ret);
546 #endif /* CONFIG_X86_32 */
549 int sys_sigaltstack(struct pt_regs *regs)
551 const stack_t __user *uss = (const stack_t __user *)regs->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 unsigned long sys_sigreturn(struct pt_regs *regs)
571 struct sigframe __user *frame;
575 frame = (struct sigframe __user *)(regs->sp - 8);
577 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
579 if (__get_user(set.sig[0], &frame->sc.oldmask) || (_NSIG_WORDS > 1
580 && __copy_from_user(&set.sig[1], &frame->extramask,
581 sizeof(frame->extramask))))
584 sigdelsetmask(&set, ~_BLOCKABLE);
585 spin_lock_irq(¤t->sighand->siglock);
586 current->blocked = set;
588 spin_unlock_irq(¤t->sighand->siglock);
590 if (restore_sigcontext(regs, &frame->sc, &ax))
595 signal_fault(regs, frame, "sigreturn");
599 #endif /* CONFIG_X86_32 */
601 long sys_rt_sigreturn(struct pt_regs *regs)
603 struct rt_sigframe __user *frame;
607 frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
608 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
610 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
613 sigdelsetmask(&set, ~_BLOCKABLE);
614 spin_lock_irq(¤t->sighand->siglock);
615 current->blocked = set;
617 spin_unlock_irq(¤t->sighand->siglock);
619 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
622 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
628 signal_fault(regs, frame, "rt_sigreturn");
633 * OK, we're invoking a handler:
635 static int signr_convert(int sig)
638 struct thread_info *info = current_thread_info();
640 if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32)
641 return info->exec_domain->signal_invmap[sig];
642 #endif /* CONFIG_X86_32 */
649 #define ia32_setup_frame __setup_frame
650 #define ia32_setup_rt_frame __setup_rt_frame
652 #else /* !CONFIG_X86_32 */
654 #ifdef CONFIG_IA32_EMULATION
655 #define is_ia32 test_thread_flag(TIF_IA32)
656 #else /* !CONFIG_IA32_EMULATION */
658 #endif /* CONFIG_IA32_EMULATION */
660 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
661 sigset_t *set, struct pt_regs *regs);
662 int ia32_setup_frame(int sig, struct k_sigaction *ka,
663 sigset_t *set, struct pt_regs *regs);
665 #endif /* CONFIG_X86_32 */
668 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
669 sigset_t *set, struct pt_regs *regs)
671 int usig = signr_convert(sig);
674 /* Set up the stack frame */
676 if (ka->sa.sa_flags & SA_SIGINFO)
677 ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
679 ret = ia32_setup_frame(usig, ka, set, regs);
681 ret = __setup_rt_frame(sig, ka, info, set, regs);
684 force_sigsegv(sig, current);
692 handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
693 sigset_t *oldset, struct pt_regs *regs)
697 /* Are we from a system call? */
698 if (syscall_get_nr(current, regs) >= 0) {
699 /* If so, check system call restarting.. */
700 switch (syscall_get_error(current, regs)) {
701 case -ERESTART_RESTARTBLOCK:
702 case -ERESTARTNOHAND:
707 if (!(ka->sa.sa_flags & SA_RESTART)) {
712 case -ERESTARTNOINTR:
713 regs->ax = regs->orig_ax;
720 * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF
721 * flag so that register information in the sigcontext is correct.
723 if (unlikely(regs->flags & X86_EFLAGS_TF) &&
724 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
725 regs->flags &= ~X86_EFLAGS_TF;
727 ret = setup_rt_frame(sig, ka, info, oldset, regs);
734 * This has nothing to do with segment registers,
735 * despite the name. This magic affects uaccess.h
736 * macros' behavior. Reset it to the normal setting.
742 * Clear the direction flag as per the ABI for function entry.
744 regs->flags &= ~X86_EFLAGS_DF;
747 * Clear TF when entering the signal handler, but
748 * notify any tracer that was single-stepping it.
749 * The tracer may want to single-step inside the
752 regs->flags &= ~X86_EFLAGS_TF;
754 spin_lock_irq(¤t->sighand->siglock);
755 sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask);
756 if (!(ka->sa.sa_flags & SA_NODEFER))
757 sigaddset(¤t->blocked, sig);
759 spin_unlock_irq(¤t->sighand->siglock);
761 tracehook_signal_handler(sig, info, ka, regs,
762 test_thread_flag(TIF_SINGLESTEP));
768 #define NR_restart_syscall __NR_restart_syscall
769 #else /* !CONFIG_X86_32 */
770 #define NR_restart_syscall \
771 test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
772 #endif /* CONFIG_X86_32 */
775 * Note that 'init' is a special process: it doesn't get signals it doesn't
776 * want to handle. Thus you cannot kill init even with a SIGKILL even by
779 static void do_signal(struct pt_regs *regs)
781 struct k_sigaction ka;
787 * We want the common case to go fast, which is why we may in certain
788 * cases get here from kernel mode. Just return without doing anything
790 * X86_32: vm86 regs switched out by assembly code before reaching
791 * here, so testing against kernel CS suffices.
793 if (!user_mode(regs))
796 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
797 oldset = ¤t->saved_sigmask;
799 oldset = ¤t->blocked;
801 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
804 * Re-enable any watchpoints before delivering the
805 * signal to user space. The processor register will
806 * have been cleared if the watchpoint triggered
809 if (current->thread.debugreg7)
810 set_debugreg(current->thread.debugreg7, 7);
812 /* Whee! Actually deliver the signal. */
813 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
815 * A signal was successfully delivered; the saved
816 * sigmask will have been stored in the signal frame,
817 * and will be restored by sigreturn, so we can simply
818 * clear the TS_RESTORE_SIGMASK flag.
820 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
825 /* Did we come from a system call? */
826 if (syscall_get_nr(current, regs) >= 0) {
827 /* Restart the system call - no handlers present */
828 switch (syscall_get_error(current, regs)) {
829 case -ERESTARTNOHAND:
831 case -ERESTARTNOINTR:
832 regs->ax = regs->orig_ax;
836 case -ERESTART_RESTARTBLOCK:
837 regs->ax = NR_restart_syscall;
844 * If there's no signal to deliver, we just put the saved sigmask
847 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
848 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
849 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL);
854 * notification of userspace execution resumption
855 * - triggered by the TIF_WORK_MASK flags
858 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
860 #if defined(CONFIG_X86_64) && defined(CONFIG_X86_MCE)
861 /* notify userspace of pending MCEs */
862 if (thread_info_flags & _TIF_MCE_NOTIFY)
864 #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */
866 /* deal with pending signal delivery */
867 if (thread_info_flags & _TIF_SIGPENDING)
870 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
871 clear_thread_flag(TIF_NOTIFY_RESUME);
872 tracehook_notify_resume(regs);
876 clear_thread_flag(TIF_IRET);
877 #endif /* CONFIG_X86_32 */
880 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
882 struct task_struct *me = current;
884 if (show_unhandled_signals && printk_ratelimit()) {
886 "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
887 task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
888 me->comm, me->pid, where, frame,
889 regs->ip, regs->sp, regs->orig_ax);
890 print_vma_addr(" in ", regs->ip);
891 printk(KERN_CONT "\n");
894 force_sig(SIGSEGV, me);