signal.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  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/smp_lock.h>
  15. #include <linux/kernel.h>
  16. #include <linux/signal.h>
  17. #include <linux/errno.h>
  18. #include <linux/wait.h>
  19. #include <linux/ptrace.h>
  20. #include <linux/unistd.h>
  21. #include <linux/stddef.h>
  22. #include <linux/tty.h>
  23. #include <linux/elf.h>
  24. #include <linux/personality.h>
  25. #include <linux/binfmts.h>
  26. #include <asm/ucontext.h>
  27. #include <asm/uaccess.h>
  28. #include <asm/pgtable.h>
  29. #include <asm/cacheflush.h>
  30. #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
  31. /*
  32. * Atomically swap in the new signal mask, and wait for a signal.
  33. */
  34. asmlinkage int
  35. sys_sigsuspend(old_sigset_t mask,
  36. unsigned long r5, unsigned long r6, unsigned long r7,
  37. struct pt_regs regs)
  38. {
  39. mask &= _BLOCKABLE;
  40. spin_lock_irq(&current->sighand->siglock);
  41. current->saved_sigmask = current->blocked;
  42. siginitset(&current->blocked, mask);
  43. recalc_sigpending();
  44. spin_unlock_irq(&current->sighand->siglock);
  45. current->state = TASK_INTERRUPTIBLE;
  46. schedule();
  47. set_thread_flag(TIF_RESTORE_SIGMASK);
  48. return -ERESTARTNOHAND;
  49. }
  50. asmlinkage int
  51. sys_sigaction(int sig, const struct old_sigaction __user *act,
  52. struct old_sigaction __user *oact)
  53. {
  54. struct k_sigaction new_ka, old_ka;
  55. int ret;
  56. if (act) {
  57. old_sigset_t mask;
  58. if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
  59. __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
  60. __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
  61. return -EFAULT;
  62. __get_user(new_ka.sa.sa_flags, &act->sa_flags);
  63. __get_user(mask, &act->sa_mask);
  64. siginitset(&new_ka.sa.sa_mask, mask);
  65. }
  66. ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
  67. if (!ret && oact) {
  68. if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
  69. __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
  70. __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
  71. return -EFAULT;
  72. __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
  73. __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
  74. }
  75. return ret;
  76. }
  77. asmlinkage int
  78. sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
  79. unsigned long r6, unsigned long r7,
  80. struct pt_regs regs)
  81. {
  82. return do_sigaltstack(uss, uoss, regs.regs[15]);
  83. }
  84. /*
  85. * Do a signal return; undo the signal stack.
  86. */
  87. #define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
  88. #if defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH2A)
  89. #define TRAP_NOARG 0xc320 /* Syscall w/no args (NR in R3) */
  90. #else
  91. #define TRAP_NOARG 0xc310 /* Syscall w/no args (NR in R3) */
  92. #endif
  93. #define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
  94. struct sigframe
  95. {
  96. struct sigcontext sc;
  97. unsigned long extramask[_NSIG_WORDS-1];
  98. u16 retcode[8];
  99. };
  100. struct rt_sigframe
  101. {
  102. struct siginfo info;
  103. struct ucontext uc;
  104. u16 retcode[8];
  105. };
  106. #ifdef CONFIG_SH_FPU
  107. static inline int restore_sigcontext_fpu(struct sigcontext __user *sc)
  108. {
  109. struct task_struct *tsk = current;
  110. if (!(cpu_data->flags & CPU_HAS_FPU))
  111. return 0;
  112. set_used_math();
  113. return __copy_from_user(&tsk->thread.fpu.hard, &sc->sc_fpregs[0],
  114. sizeof(long)*(16*2+2));
  115. }
  116. static inline int save_sigcontext_fpu(struct sigcontext __user *sc,
  117. struct pt_regs *regs)
  118. {
  119. struct task_struct *tsk = current;
  120. if (!(cpu_data->flags & CPU_HAS_FPU))
  121. return 0;
  122. if (!used_math()) {
  123. __put_user(0, &sc->sc_ownedfp);
  124. return 0;
  125. }
  126. __put_user(1, &sc->sc_ownedfp);
  127. /* This will cause a "finit" to be triggered by the next
  128. attempted FPU operation by the 'current' process.
  129. */
  130. clear_used_math();
  131. unlazy_fpu(tsk, regs);
  132. return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.fpu.hard,
  133. sizeof(long)*(16*2+2));
  134. }
  135. #endif /* CONFIG_SH_FPU */
  136. static int
  137. restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p)
  138. {
  139. unsigned int err = 0;
  140. #define COPY(x) err |= __get_user(regs->x, &sc->sc_##x)
  141. COPY(regs[1]);
  142. COPY(regs[2]); COPY(regs[3]);
  143. COPY(regs[4]); COPY(regs[5]);
  144. COPY(regs[6]); COPY(regs[7]);
  145. COPY(regs[8]); COPY(regs[9]);
  146. COPY(regs[10]); COPY(regs[11]);
  147. COPY(regs[12]); COPY(regs[13]);
  148. COPY(regs[14]); COPY(regs[15]);
  149. COPY(gbr); COPY(mach);
  150. COPY(macl); COPY(pr);
  151. COPY(sr); COPY(pc);
  152. #undef COPY
  153. #ifdef CONFIG_SH_FPU
  154. if (cpu_data->flags & CPU_HAS_FPU) {
  155. int owned_fp;
  156. struct task_struct *tsk = current;
  157. regs->sr |= SR_FD; /* Release FPU */
  158. clear_fpu(tsk, regs);
  159. clear_used_math();
  160. __get_user (owned_fp, &sc->sc_ownedfp);
  161. if (owned_fp)
  162. err |= restore_sigcontext_fpu(sc);
  163. }
  164. #endif
  165. regs->tra = -1; /* disable syscall checks */
  166. err |= __get_user(*r0_p, &sc->sc_regs[0]);
  167. return err;
  168. }
  169. asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
  170. unsigned long r6, unsigned long r7,
  171. struct pt_regs regs)
  172. {
  173. struct sigframe __user *frame = (struct sigframe __user *)regs.regs[15];
  174. sigset_t set;
  175. int r0;
  176. if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
  177. goto badframe;
  178. if (__get_user(set.sig[0], &frame->sc.oldmask)
  179. || (_NSIG_WORDS > 1
  180. && __copy_from_user(&set.sig[1], &frame->extramask,
  181. sizeof(frame->extramask))))
  182. goto badframe;
  183. sigdelsetmask(&set, ~_BLOCKABLE);
  184. spin_lock_irq(&current->sighand->siglock);
  185. current->blocked = set;
  186. recalc_sigpending();
  187. spin_unlock_irq(&current->sighand->siglock);
  188. if (restore_sigcontext(&regs, &frame->sc, &r0))
  189. goto badframe;
  190. return r0;
  191. badframe:
  192. force_sig(SIGSEGV, current);
  193. return 0;
  194. }
  195. asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
  196. unsigned long r6, unsigned long r7,
  197. struct pt_regs regs)
  198. {
  199. struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.regs[15];
  200. sigset_t set;
  201. stack_t st;
  202. int r0;
  203. if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
  204. goto badframe;
  205. if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
  206. goto badframe;
  207. sigdelsetmask(&set, ~_BLOCKABLE);
  208. spin_lock_irq(&current->sighand->siglock);
  209. current->blocked = set;
  210. recalc_sigpending();
  211. spin_unlock_irq(&current->sighand->siglock);
  212. if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &r0))
  213. goto badframe;
  214. if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
  215. goto badframe;
  216. /* It is more difficult to avoid calling this function than to
  217. call it and ignore errors. */
  218. do_sigaltstack(&st, NULL, regs.regs[15]);
  219. return r0;
  220. badframe:
  221. force_sig(SIGSEGV, current);
  222. return 0;
  223. }
  224. /*
  225. * Set up a signal frame.
  226. */
  227. static int
  228. setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
  229. unsigned long mask)
  230. {
  231. int err = 0;
  232. #define COPY(x) err |= __put_user(regs->x, &sc->sc_##x)
  233. COPY(regs[0]); COPY(regs[1]);
  234. COPY(regs[2]); COPY(regs[3]);
  235. COPY(regs[4]); COPY(regs[5]);
  236. COPY(regs[6]); COPY(regs[7]);
  237. COPY(regs[8]); COPY(regs[9]);
  238. COPY(regs[10]); COPY(regs[11]);
  239. COPY(regs[12]); COPY(regs[13]);
  240. COPY(regs[14]); COPY(regs[15]);
  241. COPY(gbr); COPY(mach);
  242. COPY(macl); COPY(pr);
  243. COPY(sr); COPY(pc);
  244. #undef COPY
  245. #ifdef CONFIG_SH_FPU
  246. err |= save_sigcontext_fpu(sc, regs);
  247. #endif
  248. /* non-iBCS2 extensions.. */
  249. err |= __put_user(mask, &sc->oldmask);
  250. return err;
  251. }
  252. /*
  253. * Determine which stack to use..
  254. */
  255. static inline void __user *
  256. get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
  257. {
  258. if (ka->sa.sa_flags & SA_ONSTACK) {
  259. if (sas_ss_flags(sp) == 0)
  260. sp = current->sas_ss_sp + current->sas_ss_size;
  261. }
  262. return (void __user *)((sp - frame_size) & -8ul);
  263. }
  264. /* These symbols are defined with the addresses in the vsyscall page.
  265. See vsyscall-trapa.S. */
  266. extern void __user __kernel_sigreturn;
  267. extern void __user __kernel_rt_sigreturn;
  268. static int setup_frame(int sig, struct k_sigaction *ka,
  269. sigset_t *set, struct pt_regs *regs)
  270. {
  271. struct sigframe __user *frame;
  272. int err = 0;
  273. int signal;
  274. frame = get_sigframe(ka, regs->regs[15], sizeof(*frame));
  275. if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  276. goto give_sigsegv;
  277. signal = current_thread_info()->exec_domain
  278. && current_thread_info()->exec_domain->signal_invmap
  279. && sig < 32
  280. ? current_thread_info()->exec_domain->signal_invmap[sig]
  281. : sig;
  282. err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
  283. if (_NSIG_WORDS > 1)
  284. err |= __copy_to_user(frame->extramask, &set->sig[1],
  285. sizeof(frame->extramask));
  286. /* Set up to return from userspace. If provided, use a stub
  287. already in userspace. */
  288. if (ka->sa.sa_flags & SA_RESTORER) {
  289. regs->pr = (unsigned long) ka->sa.sa_restorer;
  290. #ifdef CONFIG_VSYSCALL
  291. } else if (likely(current->mm->context.vdso)) {
  292. regs->pr = VDSO_SYM(&__kernel_sigreturn);
  293. #endif
  294. } else {
  295. /* Generate return code (system call to sigreturn) */
  296. err |= __put_user(MOVW(7), &frame->retcode[0]);
  297. err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
  298. err |= __put_user(OR_R0_R0, &frame->retcode[2]);
  299. err |= __put_user(OR_R0_R0, &frame->retcode[3]);
  300. err |= __put_user(OR_R0_R0, &frame->retcode[4]);
  301. err |= __put_user(OR_R0_R0, &frame->retcode[5]);
  302. err |= __put_user(OR_R0_R0, &frame->retcode[6]);
  303. err |= __put_user((__NR_sigreturn), &frame->retcode[7]);
  304. regs->pr = (unsigned long) frame->retcode;
  305. }
  306. if (err)
  307. goto give_sigsegv;
  308. /* Set up registers for signal handler */
  309. regs->regs[15] = (unsigned long) frame;
  310. regs->regs[4] = signal; /* Arg for signal handler */
  311. regs->regs[5] = 0;
  312. regs->regs[6] = (unsigned long) &frame->sc;
  313. regs->pc = (unsigned long) ka->sa.sa_handler;
  314. set_fs(USER_DS);
  315. pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
  316. current->comm, current->pid, frame, regs->pc, regs->pr);
  317. flush_cache_sigtramp(regs->pr);
  318. if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
  319. flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
  320. return 0;
  321. give_sigsegv:
  322. force_sigsegv(sig, current);
  323. return -EFAULT;
  324. }
  325. static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
  326. sigset_t *set, struct pt_regs *regs)
  327. {
  328. struct rt_sigframe __user *frame;
  329. int err = 0;
  330. int signal;
  331. frame = get_sigframe(ka, regs->regs[15], sizeof(*frame));
  332. if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  333. goto give_sigsegv;
  334. signal = current_thread_info()->exec_domain
  335. && current_thread_info()->exec_domain->signal_invmap
  336. && sig < 32
  337. ? current_thread_info()->exec_domain->signal_invmap[sig]
  338. : sig;
  339. err |= copy_siginfo_to_user(&frame->info, info);
  340. /* Create the ucontext. */
  341. err |= __put_user(0, &frame->uc.uc_flags);
  342. err |= __put_user(0, &frame->uc.uc_link);
  343. err |= __put_user((void *)current->sas_ss_sp,
  344. &frame->uc.uc_stack.ss_sp);
  345. err |= __put_user(sas_ss_flags(regs->regs[15]),
  346. &frame->uc.uc_stack.ss_flags);
  347. err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
  348. err |= setup_sigcontext(&frame->uc.uc_mcontext,
  349. regs, set->sig[0]);
  350. err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
  351. /* Set up to return from userspace. If provided, use a stub
  352. already in userspace. */
  353. if (ka->sa.sa_flags & SA_RESTORER) {
  354. regs->pr = (unsigned long) ka->sa.sa_restorer;
  355. #ifdef CONFIG_VSYSCALL
  356. } else if (likely(current->mm->context.vdso)) {
  357. regs->pr = VDSO_SYM(&__kernel_rt_sigreturn);
  358. #endif
  359. } else {
  360. /* Generate return code (system call to rt_sigreturn) */
  361. err |= __put_user(MOVW(7), &frame->retcode[0]);
  362. err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
  363. err |= __put_user(OR_R0_R0, &frame->retcode[2]);
  364. err |= __put_user(OR_R0_R0, &frame->retcode[3]);
  365. err |= __put_user(OR_R0_R0, &frame->retcode[4]);
  366. err |= __put_user(OR_R0_R0, &frame->retcode[5]);
  367. err |= __put_user(OR_R0_R0, &frame->retcode[6]);
  368. err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]);
  369. regs->pr = (unsigned long) frame->retcode;
  370. }
  371. if (err)
  372. goto give_sigsegv;
  373. /* Set up registers for signal handler */
  374. regs->regs[15] = (unsigned long) frame;
  375. regs->regs[4] = signal; /* Arg for signal handler */
  376. regs->regs[5] = (unsigned long) &frame->info;
  377. regs->regs[6] = (unsigned long) &frame->uc;
  378. regs->pc = (unsigned long) ka->sa.sa_handler;
  379. set_fs(USER_DS);
  380. pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
  381. current->comm, current->pid, frame, regs->pc, regs->pr);
  382. flush_cache_sigtramp(regs->pr);
  383. if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
  384. flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
  385. return 0;
  386. give_sigsegv:
  387. force_sigsegv(sig, current);
  388. return -EFAULT;
  389. }
  390. /*
  391. * OK, we're invoking a handler
  392. */
  393. static int
  394. handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
  395. sigset_t *oldset, struct pt_regs *regs)
  396. {
  397. int ret;
  398. /* Are we from a system call? */
  399. if (regs->tra >= 0) {
  400. /* If so, check system call restarting.. */
  401. switch (regs->regs[0]) {
  402. case -ERESTARTNOHAND:
  403. regs->regs[0] = -EINTR;
  404. break;
  405. case -ERESTARTSYS:
  406. if (!(ka->sa.sa_flags & SA_RESTART)) {
  407. regs->regs[0] = -EINTR;
  408. break;
  409. }
  410. /* fallthrough */
  411. case -ERESTARTNOINTR:
  412. regs->pc -= 2;
  413. }
  414. } else {
  415. /* gUSA handling */
  416. #ifdef CONFIG_PREEMPT
  417. unsigned long flags;
  418. local_irq_save(flags);
  419. #endif
  420. if (regs->regs[15] >= 0xc0000000) {
  421. int offset = (int)regs->regs[15];
  422. /* Reset stack pointer: clear critical region mark */
  423. regs->regs[15] = regs->regs[1];
  424. if (regs->pc < regs->regs[0])
  425. /* Go to rewind point #1 */
  426. regs->pc = regs->regs[0] + offset - 2;
  427. }
  428. #ifdef CONFIG_PREEMPT
  429. local_irq_restore(flags);
  430. #endif
  431. }
  432. /* Set up the stack frame */
  433. if (ka->sa.sa_flags & SA_SIGINFO)
  434. ret = setup_rt_frame(sig, ka, info, oldset, regs);
  435. else
  436. ret = setup_frame(sig, ka, oldset, regs);
  437. if (ka->sa.sa_flags & SA_ONESHOT)
  438. ka->sa.sa_handler = SIG_DFL;
  439. if (ret == 0) {
  440. spin_lock_irq(&current->sighand->siglock);
  441. sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
  442. if (!(ka->sa.sa_flags & SA_NODEFER))
  443. sigaddset(&current->blocked,sig);
  444. recalc_sigpending();
  445. spin_unlock_irq(&current->sighand->siglock);
  446. }
  447. return ret;
  448. }
  449. /*
  450. * Note that 'init' is a special process: it doesn't get signals it doesn't
  451. * want to handle. Thus you cannot kill init even with a SIGKILL even by
  452. * mistake.
  453. *
  454. * Note that we go through the signals twice: once to check the signals that
  455. * the kernel can handle, and then we build all the user-level signal handling
  456. * stack-frames in one go after that.
  457. */
  458. static void do_signal(struct pt_regs *regs, unsigned int save_r0)
  459. {
  460. siginfo_t info;
  461. int signr;
  462. struct k_sigaction ka;
  463. sigset_t *oldset;
  464. /*
  465. * We want the common case to go fast, which
  466. * is why we may in certain cases get here from
  467. * kernel mode. Just return without doing anything
  468. * if so.
  469. */
  470. if (!user_mode(regs))
  471. return;
  472. if (try_to_freeze())
  473. goto no_signal;
  474. if (test_thread_flag(TIF_RESTORE_SIGMASK))
  475. oldset = &current->saved_sigmask;
  476. else
  477. oldset = &current->blocked;
  478. signr = get_signal_to_deliver(&info, &ka, regs, NULL);
  479. if (signr > 0) {
  480. /* Whee! Actually deliver the signal. */
  481. if (handle_signal(signr, &ka, &info, oldset, regs) == 0) {
  482. /* a signal was successfully delivered; the saved
  483. * sigmask will have been stored in the signal frame,
  484. * and will be restored by sigreturn, so we can simply
  485. * clear the TIF_RESTORE_SIGMASK flag */
  486. if (test_thread_flag(TIF_RESTORE_SIGMASK))
  487. clear_thread_flag(TIF_RESTORE_SIGMASK);
  488. }
  489. }
  490. no_signal:
  491. /* Did we come from a system call? */
  492. if (regs->tra >= 0) {
  493. /* Restart the system call - no handlers present */
  494. if (regs->regs[0] == -ERESTARTNOHAND ||
  495. regs->regs[0] == -ERESTARTSYS ||
  496. regs->regs[0] == -ERESTARTNOINTR) {
  497. regs->regs[0] = save_r0;
  498. regs->pc -= 2;
  499. } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) {
  500. regs->pc -= 2;
  501. regs->regs[3] = __NR_restart_syscall;
  502. }
  503. }
  504. /* if there's no signal to deliver, we just put the saved sigmask
  505. * back */
  506. if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
  507. clear_thread_flag(TIF_RESTORE_SIGMASK);
  508. sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
  509. }
  510. }
  511. asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
  512. __u32 thread_info_flags)
  513. {
  514. /* deal with pending signal delivery */
  515. if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
  516. do_signal(regs, save_r0);
  517. }