signal_32.c 16 KB

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