signal.c 16 KB

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