sh: Use boot_cpu_data for FPU tests in sigcontext paths.
[safe/jmp/linux-2.6] / arch / sh / kernel / signal_32.c
1 /*
2  *  linux/arch/sh/kernel/signal.c
3  *
4  *  Copyright (C) 1991, 1992  Linus Torvalds
5  *
6  *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
7  *
8  *  SuperH version:  Copyright (C) 1999, 2000  Niibe Yutaka & Kaz Kojima
9  *
10  */
11 #include <linux/sched.h>
12 #include <linux/mm.h>
13 #include <linux/smp.h>
14 #include <linux/kernel.h>
15 #include <linux/signal.h>
16 #include <linux/errno.h>
17 #include <linux/wait.h>
18 #include <linux/ptrace.h>
19 #include <linux/unistd.h>
20 #include <linux/stddef.h>
21 #include <linux/tty.h>
22 #include <linux/elf.h>
23 #include <linux/personality.h>
24 #include <linux/binfmts.h>
25 #include <linux/freezer.h>
26 #include <linux/io.h>
27 #include <linux/tracehook.h>
28 #include <asm/system.h>
29 #include <asm/ucontext.h>
30 #include <asm/uaccess.h>
31 #include <asm/pgtable.h>
32 #include <asm/cacheflush.h>
33 #include <asm/syscalls.h>
34 #include <asm/fpu.h>
35
36 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
37
38 struct fdpic_func_descriptor {
39         unsigned long   text;
40         unsigned long   GOT;
41 };
42
43 /*
44  * The following define adds a 64 byte gap between the signal
45  * stack frame and previous contents of the stack.  This allows
46  * frame unwinding in a function epilogue but only if a frame
47  * pointer is used in the function.  This is necessary because
48  * current gcc compilers (<4.3) do not generate unwind info on
49  * SH for function epilogues.
50  */
51 #define UNWINDGUARD 64
52
53 /*
54  * Atomically swap in the new signal mask, and wait for a signal.
55  */
56 asmlinkage int
57 sys_sigsuspend(old_sigset_t mask,
58                unsigned long r5, unsigned long r6, unsigned long r7,
59                struct pt_regs __regs)
60 {
61         mask &= _BLOCKABLE;
62         spin_lock_irq(&current->sighand->siglock);
63         current->saved_sigmask = current->blocked;
64         siginitset(&current->blocked, mask);
65         recalc_sigpending();
66         spin_unlock_irq(&current->sighand->siglock);
67
68         current->state = TASK_INTERRUPTIBLE;
69         schedule();
70         set_thread_flag(TIF_RESTORE_SIGMASK);
71         return -ERESTARTNOHAND;
72 }
73
74 asmlinkage int
75 sys_sigaction(int sig, const struct old_sigaction __user *act,
76               struct old_sigaction __user *oact)
77 {
78         struct k_sigaction new_ka, old_ka;
79         int ret;
80
81         if (act) {
82                 old_sigset_t mask;
83                 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
84                     __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
85                     __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
86                         return -EFAULT;
87                 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
88                 __get_user(mask, &act->sa_mask);
89                 siginitset(&new_ka.sa.sa_mask, mask);
90         }
91
92         ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
93
94         if (!ret && oact) {
95                 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
96                     __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
97                     __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
98                         return -EFAULT;
99                 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
100                 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
101         }
102
103         return ret;
104 }
105
106 asmlinkage int
107 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
108                 unsigned long r6, unsigned long r7,
109                 struct pt_regs __regs)
110 {
111         struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
112
113         return do_sigaltstack(uss, uoss, regs->regs[15]);
114 }
115
116
117 /*
118  * Do a signal return; undo the signal stack.
119  */
120
121 #define MOVW(n)  (0x9300|((n)-2))       /* Move mem word at PC+n to R3 */
122 #if defined(CONFIG_CPU_SH2)
123 #define TRAP_NOARG 0xc320               /* Syscall w/no args (NR in R3) */
124 #else
125 #define TRAP_NOARG 0xc310               /* Syscall w/no args (NR in R3) */
126 #endif
127 #define OR_R0_R0 0x200b                 /* or r0,r0 (insert to avoid hardware bug) */
128
129 struct sigframe
130 {
131         struct sigcontext sc;
132         unsigned long extramask[_NSIG_WORDS-1];
133         u16 retcode[8];
134 };
135
136 struct rt_sigframe
137 {
138         struct siginfo info;
139         struct ucontext uc;
140         u16 retcode[8];
141 };
142
143 #ifdef CONFIG_SH_FPU
144 static inline int restore_sigcontext_fpu(struct sigcontext __user *sc)
145 {
146         struct task_struct *tsk = current;
147
148         if (!(boot_cpu_data.flags & CPU_HAS_FPU))
149                 return 0;
150
151         set_used_math();
152         return __copy_from_user(&tsk->thread.fpu.hard, &sc->sc_fpregs[0],
153                                 sizeof(long)*(16*2+2));
154 }
155
156 static inline int save_sigcontext_fpu(struct sigcontext __user *sc,
157                                       struct pt_regs *regs)
158 {
159         struct task_struct *tsk = current;
160
161         if (!(boot_cpu_data.flags & CPU_HAS_FPU))
162                 return 0;
163
164         if (!used_math()) {
165                 __put_user(0, &sc->sc_ownedfp);
166                 return 0;
167         }
168
169         __put_user(1, &sc->sc_ownedfp);
170
171         /* This will cause a "finit" to be triggered by the next
172            attempted FPU operation by the 'current' process.
173            */
174         clear_used_math();
175
176         unlazy_fpu(tsk, regs);
177         return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.fpu.hard,
178                               sizeof(long)*(16*2+2));
179 }
180 #endif /* CONFIG_SH_FPU */
181
182 static int
183 restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p)
184 {
185         unsigned int err = 0;
186
187 #define COPY(x)         err |= __get_user(regs->x, &sc->sc_##x)
188                         COPY(regs[1]);
189         COPY(regs[2]);  COPY(regs[3]);
190         COPY(regs[4]);  COPY(regs[5]);
191         COPY(regs[6]);  COPY(regs[7]);
192         COPY(regs[8]);  COPY(regs[9]);
193         COPY(regs[10]); COPY(regs[11]);
194         COPY(regs[12]); COPY(regs[13]);
195         COPY(regs[14]); COPY(regs[15]);
196         COPY(gbr);      COPY(mach);
197         COPY(macl);     COPY(pr);
198         COPY(sr);       COPY(pc);
199 #undef COPY
200
201 #ifdef CONFIG_SH_FPU
202         if (boot_cpu_data.flags & CPU_HAS_FPU) {
203                 int owned_fp;
204                 struct task_struct *tsk = current;
205
206                 regs->sr |= SR_FD; /* Release FPU */
207                 clear_fpu(tsk, regs);
208                 clear_used_math();
209                 __get_user (owned_fp, &sc->sc_ownedfp);
210                 if (owned_fp)
211                         err |= restore_sigcontext_fpu(sc);
212         }
213 #endif
214
215         regs->tra = -1;         /* disable syscall checks */
216         err |= __get_user(*r0_p, &sc->sc_regs[0]);
217         return err;
218 }
219
220 asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
221                              unsigned long r6, unsigned long r7,
222                              struct pt_regs __regs)
223 {
224         struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
225         struct sigframe __user *frame = (struct sigframe __user *)regs->regs[15];
226         sigset_t set;
227         int r0;
228
229         /* Always make any pending restarted system calls return -EINTR */
230         current_thread_info()->restart_block.fn = do_no_restart_syscall;
231
232         if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
233                 goto badframe;
234
235         if (__get_user(set.sig[0], &frame->sc.oldmask)
236             || (_NSIG_WORDS > 1
237                 && __copy_from_user(&set.sig[1], &frame->extramask,
238                                     sizeof(frame->extramask))))
239                 goto badframe;
240
241         sigdelsetmask(&set, ~_BLOCKABLE);
242
243         spin_lock_irq(&current->sighand->siglock);
244         current->blocked = set;
245         recalc_sigpending();
246         spin_unlock_irq(&current->sighand->siglock);
247
248         if (restore_sigcontext(regs, &frame->sc, &r0))
249                 goto badframe;
250         return r0;
251
252 badframe:
253         force_sig(SIGSEGV, current);
254         return 0;
255 }
256
257 asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
258                                 unsigned long r6, unsigned long r7,
259                                 struct pt_regs __regs)
260 {
261         struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
262         struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15];
263         sigset_t set;
264         int r0;
265
266         /* Always make any pending restarted system calls return -EINTR */
267         current_thread_info()->restart_block.fn = do_no_restart_syscall;
268
269         if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
270                 goto badframe;
271
272         if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
273                 goto badframe;
274
275         sigdelsetmask(&set, ~_BLOCKABLE);
276         spin_lock_irq(&current->sighand->siglock);
277         current->blocked = set;
278         recalc_sigpending();
279         spin_unlock_irq(&current->sighand->siglock);
280
281         if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
282                 goto badframe;
283
284         if (do_sigaltstack(&frame->uc.uc_stack, NULL,
285                            regs->regs[15]) == -EFAULT)
286                 goto badframe;
287
288         return r0;
289
290 badframe:
291         force_sig(SIGSEGV, current);
292         return 0;
293 }
294
295 /*
296  * Set up a signal frame.
297  */
298
299 static int
300 setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
301                  unsigned long mask)
302 {
303         int err = 0;
304
305 #define COPY(x)         err |= __put_user(regs->x, &sc->sc_##x)
306         COPY(regs[0]);  COPY(regs[1]);
307         COPY(regs[2]);  COPY(regs[3]);
308         COPY(regs[4]);  COPY(regs[5]);
309         COPY(regs[6]);  COPY(regs[7]);
310         COPY(regs[8]);  COPY(regs[9]);
311         COPY(regs[10]); COPY(regs[11]);
312         COPY(regs[12]); COPY(regs[13]);
313         COPY(regs[14]); COPY(regs[15]);
314         COPY(gbr);      COPY(mach);
315         COPY(macl);     COPY(pr);
316         COPY(sr);       COPY(pc);
317 #undef COPY
318
319 #ifdef CONFIG_SH_FPU
320         err |= save_sigcontext_fpu(sc, regs);
321 #endif
322
323         /* non-iBCS2 extensions.. */
324         err |= __put_user(mask, &sc->oldmask);
325
326         return err;
327 }
328
329 /*
330  * Determine which stack to use..
331  */
332 static inline void __user *
333 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
334 {
335         if (ka->sa.sa_flags & SA_ONSTACK) {
336                 if (sas_ss_flags(sp) == 0)
337                         sp = current->sas_ss_sp + current->sas_ss_size;
338         }
339
340         return (void __user *)((sp - (frame_size+UNWINDGUARD)) & -8ul);
341 }
342
343 /* These symbols are defined with the addresses in the vsyscall page.
344    See vsyscall-trapa.S.  */
345 extern void __kernel_sigreturn(void);
346 extern void __kernel_rt_sigreturn(void);
347
348 static int setup_frame(int sig, struct k_sigaction *ka,
349                         sigset_t *set, struct pt_regs *regs)
350 {
351         struct sigframe __user *frame;
352         int err = 0;
353         int signal;
354
355         frame = get_sigframe(ka, regs->regs[15], sizeof(*frame));
356
357         if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
358                 goto give_sigsegv;
359
360         signal = current_thread_info()->exec_domain
361                 && current_thread_info()->exec_domain->signal_invmap
362                 && sig < 32
363                 ? current_thread_info()->exec_domain->signal_invmap[sig]
364                 : sig;
365
366         err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
367
368         if (_NSIG_WORDS > 1)
369                 err |= __copy_to_user(frame->extramask, &set->sig[1],
370                                       sizeof(frame->extramask));
371
372         /* Set up to return from userspace.  If provided, use a stub
373            already in userspace.  */
374         if (ka->sa.sa_flags & SA_RESTORER) {
375                 regs->pr = (unsigned long) ka->sa.sa_restorer;
376 #ifdef CONFIG_VSYSCALL
377         } else if (likely(current->mm->context.vdso)) {
378                 regs->pr = VDSO_SYM(&__kernel_sigreturn);
379 #endif
380         } else {
381                 /* Generate return code (system call to sigreturn) */
382                 err |= __put_user(MOVW(7), &frame->retcode[0]);
383                 err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
384                 err |= __put_user(OR_R0_R0, &frame->retcode[2]);
385                 err |= __put_user(OR_R0_R0, &frame->retcode[3]);
386                 err |= __put_user(OR_R0_R0, &frame->retcode[4]);
387                 err |= __put_user(OR_R0_R0, &frame->retcode[5]);
388                 err |= __put_user(OR_R0_R0, &frame->retcode[6]);
389                 err |= __put_user((__NR_sigreturn), &frame->retcode[7]);
390                 regs->pr = (unsigned long) frame->retcode;
391                 flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
392         }
393
394         if (err)
395                 goto give_sigsegv;
396
397         /* Set up registers for signal handler */
398         regs->regs[15] = (unsigned long) frame;
399         regs->regs[4] = signal; /* Arg for signal handler */
400         regs->regs[5] = 0;
401         regs->regs[6] = (unsigned long) &frame->sc;
402
403         if (current->personality & FDPIC_FUNCPTRS) {
404                 struct fdpic_func_descriptor __user *funcptr =
405                         (struct fdpic_func_descriptor __user *)ka->sa.sa_handler;
406
407                 __get_user(regs->pc, &funcptr->text);
408                 __get_user(regs->regs[12], &funcptr->GOT);
409         } else
410                 regs->pc = (unsigned long)ka->sa.sa_handler;
411
412         set_fs(USER_DS);
413
414         pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
415                  current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
416
417         return 0;
418
419 give_sigsegv:
420         force_sigsegv(sig, current);
421         return -EFAULT;
422 }
423
424 static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
425                            sigset_t *set, struct pt_regs *regs)
426 {
427         struct rt_sigframe __user *frame;
428         int err = 0;
429         int signal;
430
431         frame = get_sigframe(ka, regs->regs[15], sizeof(*frame));
432
433         if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
434                 goto give_sigsegv;
435
436         signal = current_thread_info()->exec_domain
437                 && current_thread_info()->exec_domain->signal_invmap
438                 && sig < 32
439                 ? current_thread_info()->exec_domain->signal_invmap[sig]
440                 : sig;
441
442         err |= copy_siginfo_to_user(&frame->info, info);
443
444         /* Create the ucontext.  */
445         err |= __put_user(0, &frame->uc.uc_flags);
446         err |= __put_user(NULL, &frame->uc.uc_link);
447         err |= __put_user((void *)current->sas_ss_sp,
448                           &frame->uc.uc_stack.ss_sp);
449         err |= __put_user(sas_ss_flags(regs->regs[15]),
450                           &frame->uc.uc_stack.ss_flags);
451         err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
452         err |= setup_sigcontext(&frame->uc.uc_mcontext,
453                                 regs, set->sig[0]);
454         err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
455
456         /* Set up to return from userspace.  If provided, use a stub
457            already in userspace.  */
458         if (ka->sa.sa_flags & SA_RESTORER) {
459                 regs->pr = (unsigned long) ka->sa.sa_restorer;
460 #ifdef CONFIG_VSYSCALL
461         } else if (likely(current->mm->context.vdso)) {
462                 regs->pr = VDSO_SYM(&__kernel_rt_sigreturn);
463 #endif
464         } else {
465                 /* Generate return code (system call to rt_sigreturn) */
466                 err |= __put_user(MOVW(7), &frame->retcode[0]);
467                 err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
468                 err |= __put_user(OR_R0_R0, &frame->retcode[2]);
469                 err |= __put_user(OR_R0_R0, &frame->retcode[3]);
470                 err |= __put_user(OR_R0_R0, &frame->retcode[4]);
471                 err |= __put_user(OR_R0_R0, &frame->retcode[5]);
472                 err |= __put_user(OR_R0_R0, &frame->retcode[6]);
473                 err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]);
474                 regs->pr = (unsigned long) frame->retcode;
475         }
476
477         if (err)
478                 goto give_sigsegv;
479
480         /* Set up registers for signal handler */
481         regs->regs[15] = (unsigned long) frame;
482         regs->regs[4] = signal; /* Arg for signal handler */
483         regs->regs[5] = (unsigned long) &frame->info;
484         regs->regs[6] = (unsigned long) &frame->uc;
485
486         if (current->personality & FDPIC_FUNCPTRS) {
487                 struct fdpic_func_descriptor __user *funcptr =
488                         (struct fdpic_func_descriptor __user *)ka->sa.sa_handler;
489
490                 __get_user(regs->pc, &funcptr->text);
491                 __get_user(regs->regs[12], &funcptr->GOT);
492         } else
493                 regs->pc = (unsigned long)ka->sa.sa_handler;
494
495         set_fs(USER_DS);
496
497         pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
498                  current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
499
500         flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
501
502         return 0;
503
504 give_sigsegv:
505         force_sigsegv(sig, current);
506         return -EFAULT;
507 }
508
509 static inline void
510 handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
511                        struct sigaction *sa)
512 {
513         /* If we're not from a syscall, bail out */
514         if (regs->tra < 0)
515                 return;
516
517         /* check for system call restart.. */
518         switch (regs->regs[0]) {
519                 case -ERESTART_RESTARTBLOCK:
520                 case -ERESTARTNOHAND:
521                 no_system_call_restart:
522                         regs->regs[0] = -EINTR;
523                         break;
524
525                 case -ERESTARTSYS:
526                         if (!(sa->sa_flags & SA_RESTART))
527                                 goto no_system_call_restart;
528                 /* fallthrough */
529                 case -ERESTARTNOINTR:
530                         regs->regs[0] = save_r0;
531                         regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
532                         break;
533         }
534 }
535
536 /*
537  * OK, we're invoking a handler
538  */
539 static int
540 handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
541               sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0)
542 {
543         int ret;
544
545         /* Set up the stack frame */
546         if (ka->sa.sa_flags & SA_SIGINFO)
547                 ret = setup_rt_frame(sig, ka, info, oldset, regs);
548         else
549                 ret = setup_frame(sig, ka, oldset, regs);
550
551         if (ka->sa.sa_flags & SA_ONESHOT)
552                 ka->sa.sa_handler = SIG_DFL;
553
554         if (ret == 0) {
555                 spin_lock_irq(&current->sighand->siglock);
556                 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
557                 if (!(ka->sa.sa_flags & SA_NODEFER))
558                         sigaddset(&current->blocked,sig);
559                 recalc_sigpending();
560                 spin_unlock_irq(&current->sighand->siglock);
561         }
562
563         return ret;
564 }
565
566 /*
567  * Note that 'init' is a special process: it doesn't get signals it doesn't
568  * want to handle. Thus you cannot kill init even with a SIGKILL even by
569  * mistake.
570  *
571  * Note that we go through the signals twice: once to check the signals that
572  * the kernel can handle, and then we build all the user-level signal handling
573  * stack-frames in one go after that.
574  */
575 static void do_signal(struct pt_regs *regs, unsigned int save_r0)
576 {
577         siginfo_t info;
578         int signr;
579         struct k_sigaction ka;
580         sigset_t *oldset;
581
582         /*
583          * We want the common case to go fast, which
584          * is why we may in certain cases get here from
585          * kernel mode. Just return without doing anything
586          * if so.
587          */
588         if (!user_mode(regs))
589                 return;
590
591         if (try_to_freeze())
592                 goto no_signal;
593
594         if (test_thread_flag(TIF_RESTORE_SIGMASK))
595                 oldset = &current->saved_sigmask;
596         else
597                 oldset = &current->blocked;
598
599         signr = get_signal_to_deliver(&info, &ka, regs, NULL);
600         if (signr > 0) {
601                 handle_syscall_restart(save_r0, regs, &ka.sa);
602
603                 /* Whee!  Actually deliver the signal.  */
604                 if (handle_signal(signr, &ka, &info, oldset,
605                                   regs, save_r0) == 0) {
606                         /* a signal was successfully delivered; the saved
607                          * sigmask will have been stored in the signal frame,
608                          * and will be restored by sigreturn, so we can simply
609                          * clear the TIF_RESTORE_SIGMASK flag */
610                         if (test_thread_flag(TIF_RESTORE_SIGMASK))
611                                 clear_thread_flag(TIF_RESTORE_SIGMASK);
612
613                         tracehook_signal_handler(signr, &info, &ka, regs,
614                                         test_thread_flag(TIF_SINGLESTEP));
615                 }
616
617                 return;
618         }
619
620 no_signal:
621         /* Did we come from a system call? */
622         if (regs->tra >= 0) {
623                 /* Restart the system call - no handlers present */
624                 if (regs->regs[0] == -ERESTARTNOHAND ||
625                     regs->regs[0] == -ERESTARTSYS ||
626                     regs->regs[0] == -ERESTARTNOINTR) {
627                         regs->regs[0] = save_r0;
628                         regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
629                 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) {
630                         regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
631                         regs->regs[3] = __NR_restart_syscall;
632                 }
633         }
634
635         /* if there's no signal to deliver, we just put the saved sigmask
636          * back */
637         if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
638                 clear_thread_flag(TIF_RESTORE_SIGMASK);
639                 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
640         }
641 }
642
643 asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
644                                  unsigned long thread_info_flags)
645 {
646         /* deal with pending signal delivery */
647         if (thread_info_flags & _TIF_SIGPENDING)
648                 do_signal(regs, save_r0);
649
650         if (thread_info_flags & _TIF_NOTIFY_RESUME) {
651                 clear_thread_flag(TIF_NOTIFY_RESUME);
652                 tracehook_notify_resume(regs);
653                 if (current->replacement_session_keyring)
654                         key_replace_session_keyring();
655         }
656 }