ptrace.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/m32r/kernel/ptrace.c
  4. *
  5. * Copyright (C) 2002 Hirokazu Takata, Takeo Takahashi
  6. * Copyright (C) 2004 Hirokazu Takata, Kei Sakamoto
  7. *
  8. * Original x86 implementation:
  9. * By Ross Biro 1/23/92
  10. * edited by Linus Torvalds
  11. *
  12. * Some code taken from sh version:
  13. * Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka
  14. * Some code taken from arm version:
  15. * Copyright (C) 2000 Russell King
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/sched.h>
  19. #include <linux/sched/task_stack.h>
  20. #include <linux/mm.h>
  21. #include <linux/err.h>
  22. #include <linux/smp.h>
  23. #include <linux/errno.h>
  24. #include <linux/ptrace.h>
  25. #include <linux/user.h>
  26. #include <linux/string.h>
  27. #include <linux/signal.h>
  28. #include <asm/cacheflush.h>
  29. #include <asm/io.h>
  30. #include <linux/uaccess.h>
  31. #include <asm/pgtable.h>
  32. #include <asm/processor.h>
  33. #include <asm/mmu_context.h>
  34. /*
  35. * This routine will get a word off of the process kernel stack.
  36. */
  37. static inline unsigned long int
  38. get_stack_long(struct task_struct *task, int offset)
  39. {
  40. unsigned long *stack;
  41. stack = (unsigned long *)task_pt_regs(task);
  42. return stack[offset];
  43. }
  44. /*
  45. * This routine will put a word on the process kernel stack.
  46. */
  47. static inline int
  48. put_stack_long(struct task_struct *task, int offset, unsigned long data)
  49. {
  50. unsigned long *stack;
  51. stack = (unsigned long *)task_pt_regs(task);
  52. stack[offset] = data;
  53. return 0;
  54. }
  55. static int reg_offset[] = {
  56. PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7,
  57. PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_FP, PT_LR, PT_SPU,
  58. };
  59. /*
  60. * Read the word at offset "off" into the "struct user". We
  61. * actually access the pt_regs stored on the kernel stack.
  62. */
  63. static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
  64. unsigned long __user *data)
  65. {
  66. unsigned long tmp;
  67. #ifndef NO_FPU
  68. struct user * dummy = NULL;
  69. #endif
  70. if ((off & 3) || off > sizeof(struct user) - 3)
  71. return -EIO;
  72. off >>= 2;
  73. switch (off) {
  74. case PT_EVB:
  75. __asm__ __volatile__ (
  76. "mvfc %0, cr5 \n\t"
  77. : "=r" (tmp)
  78. );
  79. break;
  80. case PT_CBR: {
  81. unsigned long psw;
  82. psw = get_stack_long(tsk, PT_PSW);
  83. tmp = ((psw >> 8) & 1);
  84. }
  85. break;
  86. case PT_PSW: {
  87. unsigned long psw, bbpsw;
  88. psw = get_stack_long(tsk, PT_PSW);
  89. bbpsw = get_stack_long(tsk, PT_BBPSW);
  90. tmp = ((psw >> 8) & 0xff) | ((bbpsw & 0xff) << 8);
  91. }
  92. break;
  93. case PT_PC:
  94. tmp = get_stack_long(tsk, PT_BPC);
  95. break;
  96. case PT_BPC:
  97. off = PT_BBPC;
  98. /* fall through */
  99. default:
  100. if (off < (sizeof(struct pt_regs) >> 2))
  101. tmp = get_stack_long(tsk, off);
  102. #ifndef NO_FPU
  103. else if (off >= (long)(&dummy->fpu >> 2) &&
  104. off < (long)(&dummy->u_fpvalid >> 2)) {
  105. if (!tsk_used_math(tsk)) {
  106. if (off == (long)(&dummy->fpu.fpscr >> 2))
  107. tmp = FPSCR_INIT;
  108. else
  109. tmp = 0;
  110. } else
  111. tmp = ((long *)(&tsk->thread.fpu >> 2))
  112. [off - (long)&dummy->fpu];
  113. } else if (off == (long)(&dummy->u_fpvalid >> 2))
  114. tmp = !!tsk_used_math(tsk);
  115. #endif /* not NO_FPU */
  116. else
  117. tmp = 0;
  118. }
  119. return put_user(tmp, data);
  120. }
  121. static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
  122. unsigned long data)
  123. {
  124. int ret = -EIO;
  125. #ifndef NO_FPU
  126. struct user * dummy = NULL;
  127. #endif
  128. if ((off & 3) || off > sizeof(struct user) - 3)
  129. return -EIO;
  130. off >>= 2;
  131. switch (off) {
  132. case PT_EVB:
  133. case PT_BPC:
  134. case PT_SPI:
  135. /* We don't allow to modify evb. */
  136. ret = 0;
  137. break;
  138. case PT_PSW:
  139. case PT_CBR: {
  140. /* We allow to modify only cbr in psw */
  141. unsigned long psw;
  142. psw = get_stack_long(tsk, PT_PSW);
  143. psw = (psw & ~0x100) | ((data & 1) << 8);
  144. ret = put_stack_long(tsk, PT_PSW, psw);
  145. }
  146. break;
  147. case PT_PC:
  148. off = PT_BPC;
  149. data &= ~1;
  150. /* fall through */
  151. default:
  152. if (off < (sizeof(struct pt_regs) >> 2))
  153. ret = put_stack_long(tsk, off, data);
  154. #ifndef NO_FPU
  155. else if (off >= (long)(&dummy->fpu >> 2) &&
  156. off < (long)(&dummy->u_fpvalid >> 2)) {
  157. set_stopped_child_used_math(tsk);
  158. ((long *)&tsk->thread.fpu)
  159. [off - (long)&dummy->fpu] = data;
  160. ret = 0;
  161. } else if (off == (long)(&dummy->u_fpvalid >> 2)) {
  162. conditional_stopped_child_used_math(data, tsk);
  163. ret = 0;
  164. }
  165. #endif /* not NO_FPU */
  166. break;
  167. }
  168. return ret;
  169. }
  170. /*
  171. * Get all user integer registers.
  172. */
  173. static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
  174. {
  175. struct pt_regs *regs = task_pt_regs(tsk);
  176. return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
  177. }
  178. /*
  179. * Set all user integer registers.
  180. */
  181. static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
  182. {
  183. struct pt_regs newregs;
  184. int ret;
  185. ret = -EFAULT;
  186. if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
  187. struct pt_regs *regs = task_pt_regs(tsk);
  188. *regs = newregs;
  189. ret = 0;
  190. }
  191. return ret;
  192. }
  193. static inline int
  194. check_condition_bit(struct task_struct *child)
  195. {
  196. return (int)((get_stack_long(child, PT_PSW) >> 8) & 1);
  197. }
  198. static int
  199. check_condition_src(unsigned long op, unsigned long regno1,
  200. unsigned long regno2, struct task_struct *child)
  201. {
  202. unsigned long reg1, reg2;
  203. reg2 = get_stack_long(child, reg_offset[regno2]);
  204. switch (op) {
  205. case 0x0: /* BEQ */
  206. reg1 = get_stack_long(child, reg_offset[regno1]);
  207. return reg1 == reg2;
  208. case 0x1: /* BNE */
  209. reg1 = get_stack_long(child, reg_offset[regno1]);
  210. return reg1 != reg2;
  211. case 0x8: /* BEQZ */
  212. return reg2 == 0;
  213. case 0x9: /* BNEZ */
  214. return reg2 != 0;
  215. case 0xa: /* BLTZ */
  216. return (int)reg2 < 0;
  217. case 0xb: /* BGEZ */
  218. return (int)reg2 >= 0;
  219. case 0xc: /* BLEZ */
  220. return (int)reg2 <= 0;
  221. case 0xd: /* BGTZ */
  222. return (int)reg2 > 0;
  223. default:
  224. /* never reached */
  225. return 0;
  226. }
  227. }
  228. static void
  229. compute_next_pc_for_16bit_insn(unsigned long insn, unsigned long pc,
  230. unsigned long *next_pc,
  231. struct task_struct *child)
  232. {
  233. unsigned long op, op2, op3;
  234. unsigned long disp;
  235. unsigned long regno;
  236. int parallel = 0;
  237. if (insn & 0x00008000)
  238. parallel = 1;
  239. if (pc & 3)
  240. insn &= 0x7fff; /* right slot */
  241. else
  242. insn >>= 16; /* left slot */
  243. op = (insn >> 12) & 0xf;
  244. op2 = (insn >> 8) & 0xf;
  245. op3 = (insn >> 4) & 0xf;
  246. if (op == 0x7) {
  247. switch (op2) {
  248. case 0xd: /* BNC */
  249. case 0x9: /* BNCL */
  250. if (!check_condition_bit(child)) {
  251. disp = (long)(insn << 24) >> 22;
  252. *next_pc = (pc & ~0x3) + disp;
  253. return;
  254. }
  255. break;
  256. case 0x8: /* BCL */
  257. case 0xc: /* BC */
  258. if (check_condition_bit(child)) {
  259. disp = (long)(insn << 24) >> 22;
  260. *next_pc = (pc & ~0x3) + disp;
  261. return;
  262. }
  263. break;
  264. case 0xe: /* BL */
  265. case 0xf: /* BRA */
  266. disp = (long)(insn << 24) >> 22;
  267. *next_pc = (pc & ~0x3) + disp;
  268. return;
  269. break;
  270. }
  271. } else if (op == 0x1) {
  272. switch (op2) {
  273. case 0x0:
  274. if (op3 == 0xf) { /* TRAP */
  275. #if 1
  276. /* pass through */
  277. #else
  278. /* kernel space is not allowed as next_pc */
  279. unsigned long evb;
  280. unsigned long trapno;
  281. trapno = insn & 0xf;
  282. __asm__ __volatile__ (
  283. "mvfc %0, cr5\n"
  284. :"=r"(evb)
  285. :
  286. );
  287. *next_pc = evb + (trapno << 2);
  288. return;
  289. #endif
  290. } else if (op3 == 0xd) { /* RTE */
  291. *next_pc = get_stack_long(child, PT_BPC);
  292. return;
  293. }
  294. break;
  295. case 0xc: /* JC */
  296. if (op3 == 0xc && check_condition_bit(child)) {
  297. regno = insn & 0xf;
  298. *next_pc = get_stack_long(child,
  299. reg_offset[regno]);
  300. return;
  301. }
  302. break;
  303. case 0xd: /* JNC */
  304. if (op3 == 0xc && !check_condition_bit(child)) {
  305. regno = insn & 0xf;
  306. *next_pc = get_stack_long(child,
  307. reg_offset[regno]);
  308. return;
  309. }
  310. break;
  311. case 0xe: /* JL */
  312. case 0xf: /* JMP */
  313. if (op3 == 0xc) { /* JMP */
  314. regno = insn & 0xf;
  315. *next_pc = get_stack_long(child,
  316. reg_offset[regno]);
  317. return;
  318. }
  319. break;
  320. }
  321. }
  322. if (parallel)
  323. *next_pc = pc + 4;
  324. else
  325. *next_pc = pc + 2;
  326. }
  327. static void
  328. compute_next_pc_for_32bit_insn(unsigned long insn, unsigned long pc,
  329. unsigned long *next_pc,
  330. struct task_struct *child)
  331. {
  332. unsigned long op;
  333. unsigned long op2;
  334. unsigned long disp;
  335. unsigned long regno1, regno2;
  336. op = (insn >> 28) & 0xf;
  337. if (op == 0xf) { /* branch 24-bit relative */
  338. op2 = (insn >> 24) & 0xf;
  339. switch (op2) {
  340. case 0xd: /* BNC */
  341. case 0x9: /* BNCL */
  342. if (!check_condition_bit(child)) {
  343. disp = (long)(insn << 8) >> 6;
  344. *next_pc = (pc & ~0x3) + disp;
  345. return;
  346. }
  347. break;
  348. case 0x8: /* BCL */
  349. case 0xc: /* BC */
  350. if (check_condition_bit(child)) {
  351. disp = (long)(insn << 8) >> 6;
  352. *next_pc = (pc & ~0x3) + disp;
  353. return;
  354. }
  355. break;
  356. case 0xe: /* BL */
  357. case 0xf: /* BRA */
  358. disp = (long)(insn << 8) >> 6;
  359. *next_pc = (pc & ~0x3) + disp;
  360. return;
  361. }
  362. } else if (op == 0xb) { /* branch 16-bit relative */
  363. op2 = (insn >> 20) & 0xf;
  364. switch (op2) {
  365. case 0x0: /* BEQ */
  366. case 0x1: /* BNE */
  367. case 0x8: /* BEQZ */
  368. case 0x9: /* BNEZ */
  369. case 0xa: /* BLTZ */
  370. case 0xb: /* BGEZ */
  371. case 0xc: /* BLEZ */
  372. case 0xd: /* BGTZ */
  373. regno1 = ((insn >> 24) & 0xf);
  374. regno2 = ((insn >> 16) & 0xf);
  375. if (check_condition_src(op2, regno1, regno2, child)) {
  376. disp = (long)(insn << 16) >> 14;
  377. *next_pc = (pc & ~0x3) + disp;
  378. return;
  379. }
  380. break;
  381. }
  382. }
  383. *next_pc = pc + 4;
  384. }
  385. static inline void
  386. compute_next_pc(unsigned long insn, unsigned long pc,
  387. unsigned long *next_pc, struct task_struct *child)
  388. {
  389. if (insn & 0x80000000)
  390. compute_next_pc_for_32bit_insn(insn, pc, next_pc, child);
  391. else
  392. compute_next_pc_for_16bit_insn(insn, pc, next_pc, child);
  393. }
  394. static int
  395. register_debug_trap(struct task_struct *child, unsigned long next_pc,
  396. unsigned long next_insn, unsigned long *code)
  397. {
  398. struct debug_trap *p = &child->thread.debug_trap;
  399. unsigned long addr = next_pc & ~3;
  400. if (p->nr_trap == MAX_TRAPS) {
  401. printk("kernel BUG at %s %d: p->nr_trap = %d\n",
  402. __FILE__, __LINE__, p->nr_trap);
  403. return -1;
  404. }
  405. p->addr[p->nr_trap] = addr;
  406. p->insn[p->nr_trap] = next_insn;
  407. p->nr_trap++;
  408. if (next_pc & 3) {
  409. *code = (next_insn & 0xffff0000) | 0x10f1;
  410. /* xxx --> TRAP1 */
  411. } else {
  412. if ((next_insn & 0x80000000) || (next_insn & 0x8000)) {
  413. *code = 0x10f17000;
  414. /* TRAP1 --> NOP */
  415. } else {
  416. *code = (next_insn & 0xffff) | 0x10f10000;
  417. /* TRAP1 --> xxx */
  418. }
  419. }
  420. return 0;
  421. }
  422. static int
  423. unregister_debug_trap(struct task_struct *child, unsigned long addr,
  424. unsigned long *code)
  425. {
  426. struct debug_trap *p = &child->thread.debug_trap;
  427. int i;
  428. /* Search debug trap entry. */
  429. for (i = 0; i < p->nr_trap; i++) {
  430. if (p->addr[i] == addr)
  431. break;
  432. }
  433. if (i >= p->nr_trap) {
  434. /* The trap may be requested from debugger.
  435. * ptrace should do nothing in this case.
  436. */
  437. return 0;
  438. }
  439. /* Recover original instruction code. */
  440. *code = p->insn[i];
  441. /* Shift debug trap entries. */
  442. while (i < p->nr_trap - 1) {
  443. p->insn[i] = p->insn[i + 1];
  444. p->addr[i] = p->addr[i + 1];
  445. i++;
  446. }
  447. p->nr_trap--;
  448. return 1;
  449. }
  450. static void
  451. unregister_all_debug_traps(struct task_struct *child)
  452. {
  453. struct debug_trap *p = &child->thread.debug_trap;
  454. int i;
  455. for (i = 0; i < p->nr_trap; i++)
  456. access_process_vm(child, p->addr[i], &p->insn[i], sizeof(p->insn[i]),
  457. FOLL_FORCE | FOLL_WRITE);
  458. p->nr_trap = 0;
  459. }
  460. static inline void
  461. invalidate_cache(void)
  462. {
  463. #if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP)
  464. _flush_cache_copyback_all();
  465. #else /* ! CONFIG_CHIP_M32700 */
  466. /* Invalidate cache */
  467. __asm__ __volatile__ (
  468. "ldi r0, #-1 \n\t"
  469. "ldi r1, #0 \n\t"
  470. "stb r1, @r0 ; cache off \n\t"
  471. "; \n\t"
  472. "ldi r0, #-2 \n\t"
  473. "ldi r1, #1 \n\t"
  474. "stb r1, @r0 ; cache invalidate \n\t"
  475. ".fillinsn \n"
  476. "0: \n\t"
  477. "ldb r1, @r0 ; invalidate check \n\t"
  478. "bnez r1, 0b \n\t"
  479. "; \n\t"
  480. "ldi r0, #-1 \n\t"
  481. "ldi r1, #1 \n\t"
  482. "stb r1, @r0 ; cache on \n\t"
  483. : : : "r0", "r1", "memory"
  484. );
  485. /* FIXME: copying-back d-cache and invalidating i-cache are needed.
  486. */
  487. #endif /* CONFIG_CHIP_M32700 */
  488. }
  489. /* Embed a debug trap (TRAP1) code */
  490. static int
  491. embed_debug_trap(struct task_struct *child, unsigned long next_pc)
  492. {
  493. unsigned long next_insn, code;
  494. unsigned long addr = next_pc & ~3;
  495. if (access_process_vm(child, addr, &next_insn, sizeof(next_insn),
  496. FOLL_FORCE)
  497. != sizeof(next_insn)) {
  498. return -1; /* error */
  499. }
  500. /* Set a trap code. */
  501. if (register_debug_trap(child, next_pc, next_insn, &code)) {
  502. return -1; /* error */
  503. }
  504. if (access_process_vm(child, addr, &code, sizeof(code),
  505. FOLL_FORCE | FOLL_WRITE)
  506. != sizeof(code)) {
  507. return -1; /* error */
  508. }
  509. return 0; /* success */
  510. }
  511. void
  512. withdraw_debug_trap(struct pt_regs *regs)
  513. {
  514. unsigned long addr;
  515. unsigned long code;
  516. addr = (regs->bpc - 2) & ~3;
  517. regs->bpc -= 2;
  518. if (unregister_debug_trap(current, addr, &code)) {
  519. access_process_vm(current, addr, &code, sizeof(code),
  520. FOLL_FORCE | FOLL_WRITE);
  521. invalidate_cache();
  522. }
  523. }
  524. void
  525. init_debug_traps(struct task_struct *child)
  526. {
  527. struct debug_trap *p = &child->thread.debug_trap;
  528. int i;
  529. p->nr_trap = 0;
  530. for (i = 0; i < MAX_TRAPS; i++) {
  531. p->addr[i] = 0;
  532. p->insn[i] = 0;
  533. }
  534. }
  535. void user_enable_single_step(struct task_struct *child)
  536. {
  537. unsigned long next_pc;
  538. unsigned long pc, insn;
  539. clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  540. /* Compute next pc. */
  541. pc = get_stack_long(child, PT_BPC);
  542. if (access_process_vm(child, pc&~3, &insn, sizeof(insn),
  543. FOLL_FORCE)
  544. != sizeof(insn))
  545. return;
  546. compute_next_pc(insn, pc, &next_pc, child);
  547. if (next_pc & 0x80000000)
  548. return;
  549. if (embed_debug_trap(child, next_pc))
  550. return;
  551. invalidate_cache();
  552. }
  553. void user_disable_single_step(struct task_struct *child)
  554. {
  555. unregister_all_debug_traps(child);
  556. invalidate_cache();
  557. }
  558. /*
  559. * Called by kernel/ptrace.c when detaching..
  560. *
  561. * Make sure single step bits etc are not set.
  562. */
  563. void ptrace_disable(struct task_struct *child)
  564. {
  565. /* nothing to do.. */
  566. }
  567. long
  568. arch_ptrace(struct task_struct *child, long request,
  569. unsigned long addr, unsigned long data)
  570. {
  571. int ret;
  572. unsigned long __user *datap = (unsigned long __user *) data;
  573. switch (request) {
  574. /*
  575. * read word at location "addr" in the child process.
  576. */
  577. case PTRACE_PEEKTEXT:
  578. case PTRACE_PEEKDATA:
  579. ret = generic_ptrace_peekdata(child, addr, data);
  580. break;
  581. /*
  582. * read the word at location addr in the USER area.
  583. */
  584. case PTRACE_PEEKUSR:
  585. ret = ptrace_read_user(child, addr, datap);
  586. break;
  587. /*
  588. * write the word at location addr.
  589. */
  590. case PTRACE_POKETEXT:
  591. case PTRACE_POKEDATA:
  592. ret = generic_ptrace_pokedata(child, addr, data);
  593. if (ret == 0 && request == PTRACE_POKETEXT)
  594. invalidate_cache();
  595. break;
  596. /*
  597. * write the word at location addr in the USER area.
  598. */
  599. case PTRACE_POKEUSR:
  600. ret = ptrace_write_user(child, addr, data);
  601. break;
  602. case PTRACE_GETREGS:
  603. ret = ptrace_getregs(child, datap);
  604. break;
  605. case PTRACE_SETREGS:
  606. ret = ptrace_setregs(child, datap);
  607. break;
  608. default:
  609. ret = ptrace_request(child, request, addr, data);
  610. break;
  611. }
  612. return ret;
  613. }
  614. /* notification of system call entry/exit
  615. * - triggered by current->work.syscall_trace
  616. */
  617. void do_syscall_trace(void)
  618. {
  619. if (!test_thread_flag(TIF_SYSCALL_TRACE))
  620. return;
  621. if (!(current->ptrace & PT_PTRACED))
  622. return;
  623. /* the 0x80 provides a way for the tracing parent to distinguish
  624. between a syscall stop and SIGTRAP delivery */
  625. ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
  626. ? 0x80 : 0));
  627. /*
  628. * this isn't the same as continuing with a signal, but it will do
  629. * for normal use. strace only continues with a signal if the
  630. * stopping signal is not SIGTRAP. -brl
  631. */
  632. if (current->exit_code) {
  633. send_sig(current->exit_code, current, 1);
  634. current->exit_code = 0;
  635. }
  636. }