signal_32.c 16 KB

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