ptrace.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /*
  2. * linux/arch/arm26/kernel/ptrace.c
  3. *
  4. * By Ross Biro 1/23/92
  5. * edited by Linus Torvalds
  6. * ARM modifications Copyright (C) 2000 Russell King
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/config.h>
  13. #include <linux/kernel.h>
  14. #include <linux/sched.h>
  15. #include <linux/mm.h>
  16. #include <linux/smp.h>
  17. #include <linux/smp_lock.h>
  18. #include <linux/ptrace.h>
  19. #include <linux/user.h>
  20. #include <linux/security.h>
  21. #include <linux/signal.h>
  22. #include <asm/uaccess.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/system.h>
  25. //#include <asm/processor.h>
  26. #include "ptrace.h"
  27. #define REG_PC 15
  28. #define REG_PSR 15
  29. /*
  30. * does not yet catch signals sent when the child dies.
  31. * in exit.c or in signal.c.
  32. */
  33. /*
  34. * Breakpoint SWI instruction: SWI &9F0001
  35. */
  36. #define BREAKINST_ARM 0xef9f0001
  37. /*
  38. * Get the address of the live pt_regs for the specified task.
  39. * These are saved onto the top kernel stack when the process
  40. * is not running.
  41. *
  42. * Note: if a user thread is execve'd from kernel space, the
  43. * kernel stack will not be empty on entry to the kernel, so
  44. * ptracing these tasks will fail.
  45. */
  46. static inline struct pt_regs *
  47. get_user_regs(struct task_struct *task)
  48. {
  49. return __get_user_regs(task->thread_info);
  50. }
  51. /*
  52. * this routine will get a word off of the processes privileged stack.
  53. * the offset is how far from the base addr as stored in the THREAD.
  54. * this routine assumes that all the privileged stacks are in our
  55. * data space.
  56. */
  57. static inline long get_user_reg(struct task_struct *task, int offset)
  58. {
  59. return get_user_regs(task)->uregs[offset];
  60. }
  61. /*
  62. * this routine will put a word on the processes privileged stack.
  63. * the offset is how far from the base addr as stored in the THREAD.
  64. * this routine assumes that all the privileged stacks are in our
  65. * data space.
  66. */
  67. static inline int
  68. put_user_reg(struct task_struct *task, int offset, long data)
  69. {
  70. struct pt_regs newregs, *regs = get_user_regs(task);
  71. int ret = -EINVAL;
  72. newregs = *regs;
  73. newregs.uregs[offset] = data;
  74. if (valid_user_regs(&newregs)) {
  75. regs->uregs[offset] = data;
  76. ret = 0;
  77. }
  78. return ret;
  79. }
  80. static inline int
  81. read_u32(struct task_struct *task, unsigned long addr, u32 *res)
  82. {
  83. int ret;
  84. ret = access_process_vm(task, addr, res, sizeof(*res), 0);
  85. return ret == sizeof(*res) ? 0 : -EIO;
  86. }
  87. static inline int
  88. read_instr(struct task_struct *task, unsigned long addr, u32 *res)
  89. {
  90. int ret;
  91. u32 val;
  92. ret = access_process_vm(task, addr & ~3, &val, sizeof(val), 0);
  93. ret = ret == sizeof(val) ? 0 : -EIO;
  94. *res = val;
  95. return ret;
  96. }
  97. /*
  98. * Get value of register `rn' (in the instruction)
  99. */
  100. static unsigned long
  101. ptrace_getrn(struct task_struct *child, unsigned long insn)
  102. {
  103. unsigned int reg = (insn >> 16) & 15;
  104. unsigned long val;
  105. val = get_user_reg(child, reg);
  106. if (reg == 15)
  107. val = pc_pointer(val + 8); //FIXME - correct for arm26?
  108. return val;
  109. }
  110. /*
  111. * Get value of operand 2 (in an ALU instruction)
  112. */
  113. static unsigned long
  114. ptrace_getaluop2(struct task_struct *child, unsigned long insn)
  115. {
  116. unsigned long val;
  117. int shift;
  118. int type;
  119. if (insn & 1 << 25) {
  120. val = insn & 255;
  121. shift = (insn >> 8) & 15;
  122. type = 3;
  123. } else {
  124. val = get_user_reg (child, insn & 15);
  125. if (insn & (1 << 4))
  126. shift = (int)get_user_reg (child, (insn >> 8) & 15);
  127. else
  128. shift = (insn >> 7) & 31;
  129. type = (insn >> 5) & 3;
  130. }
  131. switch (type) {
  132. case 0: val <<= shift; break;
  133. case 1: val >>= shift; break;
  134. case 2:
  135. val = (((signed long)val) >> shift);
  136. break;
  137. case 3:
  138. val = (val >> shift) | (val << (32 - shift));
  139. break;
  140. }
  141. return val;
  142. }
  143. /*
  144. * Get value of operand 2 (in a LDR instruction)
  145. */
  146. static unsigned long
  147. ptrace_getldrop2(struct task_struct *child, unsigned long insn)
  148. {
  149. unsigned long val;
  150. int shift;
  151. int type;
  152. val = get_user_reg(child, insn & 15);
  153. shift = (insn >> 7) & 31;
  154. type = (insn >> 5) & 3;
  155. switch (type) {
  156. case 0: val <<= shift; break;
  157. case 1: val >>= shift; break;
  158. case 2:
  159. val = (((signed long)val) >> shift);
  160. break;
  161. case 3:
  162. val = (val >> shift) | (val << (32 - shift));
  163. break;
  164. }
  165. return val;
  166. }
  167. #define OP_MASK 0x01e00000
  168. #define OP_AND 0x00000000
  169. #define OP_EOR 0x00200000
  170. #define OP_SUB 0x00400000
  171. #define OP_RSB 0x00600000
  172. #define OP_ADD 0x00800000
  173. #define OP_ADC 0x00a00000
  174. #define OP_SBC 0x00c00000
  175. #define OP_RSC 0x00e00000
  176. #define OP_ORR 0x01800000
  177. #define OP_MOV 0x01a00000
  178. #define OP_BIC 0x01c00000
  179. #define OP_MVN 0x01e00000
  180. static unsigned long
  181. get_branch_address(struct task_struct *child, unsigned long pc, unsigned long insn)
  182. {
  183. u32 alt = 0;
  184. switch (insn & 0x0e000000) {
  185. case 0x00000000:
  186. case 0x02000000: {
  187. /*
  188. * data processing
  189. */
  190. long aluop1, aluop2, ccbit;
  191. if ((insn & 0xf000) != 0xf000)
  192. break;
  193. aluop1 = ptrace_getrn(child, insn);
  194. aluop2 = ptrace_getaluop2(child, insn);
  195. ccbit = get_user_reg(child, REG_PSR) & PSR_C_BIT ? 1 : 0;
  196. switch (insn & OP_MASK) {
  197. case OP_AND: alt = aluop1 & aluop2; break;
  198. case OP_EOR: alt = aluop1 ^ aluop2; break;
  199. case OP_SUB: alt = aluop1 - aluop2; break;
  200. case OP_RSB: alt = aluop2 - aluop1; break;
  201. case OP_ADD: alt = aluop1 + aluop2; break;
  202. case OP_ADC: alt = aluop1 + aluop2 + ccbit; break;
  203. case OP_SBC: alt = aluop1 - aluop2 + ccbit; break;
  204. case OP_RSC: alt = aluop2 - aluop1 + ccbit; break;
  205. case OP_ORR: alt = aluop1 | aluop2; break;
  206. case OP_MOV: alt = aluop2; break;
  207. case OP_BIC: alt = aluop1 & ~aluop2; break;
  208. case OP_MVN: alt = ~aluop2; break;
  209. }
  210. break;
  211. }
  212. case 0x04000000:
  213. case 0x06000000:
  214. /*
  215. * ldr
  216. */
  217. if ((insn & 0x0010f000) == 0x0010f000) {
  218. unsigned long base;
  219. base = ptrace_getrn(child, insn);
  220. if (insn & 1 << 24) {
  221. long aluop2;
  222. if (insn & 0x02000000)
  223. aluop2 = ptrace_getldrop2(child, insn);
  224. else
  225. aluop2 = insn & 0xfff;
  226. if (insn & 1 << 23)
  227. base += aluop2;
  228. else
  229. base -= aluop2;
  230. }
  231. if (read_u32(child, base, &alt) == 0)
  232. alt = pc_pointer(alt);
  233. }
  234. break;
  235. case 0x08000000:
  236. /*
  237. * ldm
  238. */
  239. if ((insn & 0x00108000) == 0x00108000) {
  240. unsigned long base;
  241. unsigned int nr_regs;
  242. if (insn & (1 << 23)) {
  243. nr_regs = hweight16(insn & 65535) << 2;
  244. if (!(insn & (1 << 24)))
  245. nr_regs -= 4;
  246. } else {
  247. if (insn & (1 << 24))
  248. nr_regs = -4;
  249. else
  250. nr_regs = 0;
  251. }
  252. base = ptrace_getrn(child, insn);
  253. if (read_u32(child, base + nr_regs, &alt) == 0)
  254. alt = pc_pointer(alt);
  255. break;
  256. }
  257. break;
  258. case 0x0a000000: {
  259. /*
  260. * bl or b
  261. */
  262. signed long displ;
  263. /* It's a branch/branch link: instead of trying to
  264. * figure out whether the branch will be taken or not,
  265. * we'll put a breakpoint at both locations. This is
  266. * simpler, more reliable, and probably not a whole lot
  267. * slower than the alternative approach of emulating the
  268. * branch.
  269. */
  270. displ = (insn & 0x00ffffff) << 8;
  271. displ = (displ >> 6) + 8;
  272. if (displ != 0 && displ != 4)
  273. alt = pc + displ;
  274. }
  275. break;
  276. }
  277. return alt;
  278. }
  279. static int
  280. swap_insn(struct task_struct *task, unsigned long addr,
  281. void *old_insn, void *new_insn, int size)
  282. {
  283. int ret;
  284. ret = access_process_vm(task, addr, old_insn, size, 0);
  285. if (ret == size)
  286. ret = access_process_vm(task, addr, new_insn, size, 1);
  287. return ret;
  288. }
  289. static void
  290. add_breakpoint(struct task_struct *task, struct debug_info *dbg, unsigned long addr)
  291. {
  292. int nr = dbg->nsaved;
  293. if (nr < 2) {
  294. u32 new_insn = BREAKINST_ARM;
  295. int res;
  296. res = swap_insn(task, addr, &dbg->bp[nr].insn, &new_insn, 4);
  297. if (res == 4) {
  298. dbg->bp[nr].address = addr;
  299. dbg->nsaved += 1;
  300. }
  301. } else
  302. printk(KERN_ERR "ptrace: too many breakpoints\n");
  303. }
  304. /*
  305. * Clear one breakpoint in the user program. We copy what the hardware
  306. * does and use bit 0 of the address to indicate whether this is a Thumb
  307. * breakpoint or an ARM breakpoint.
  308. */
  309. static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
  310. {
  311. unsigned long addr = bp->address;
  312. u32 old_insn;
  313. int ret;
  314. ret = swap_insn(task, addr & ~3, &old_insn,
  315. &bp->insn, 4);
  316. if (ret != 4 || old_insn != BREAKINST_ARM)
  317. printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
  318. "0x%08lx (0x%08x)\n", task->comm, task->pid,
  319. addr, old_insn);
  320. }
  321. void ptrace_set_bpt(struct task_struct *child)
  322. {
  323. struct pt_regs *regs;
  324. unsigned long pc;
  325. u32 insn;
  326. int res;
  327. regs = get_user_regs(child);
  328. pc = instruction_pointer(regs);
  329. res = read_instr(child, pc, &insn);
  330. if (!res) {
  331. struct debug_info *dbg = &child->thread.debug;
  332. unsigned long alt;
  333. dbg->nsaved = 0;
  334. alt = get_branch_address(child, pc, insn);
  335. if (alt)
  336. add_breakpoint(child, dbg, alt);
  337. /*
  338. * Note that we ignore the result of setting the above
  339. * breakpoint since it may fail. When it does, this is
  340. * not so much an error, but a forewarning that we may
  341. * be receiving a prefetch abort shortly.
  342. *
  343. * If we don't set this breakpoint here, then we can
  344. * lose control of the thread during single stepping.
  345. */
  346. if (!alt || predicate(insn) != PREDICATE_ALWAYS)
  347. add_breakpoint(child, dbg, pc + 4);
  348. }
  349. }
  350. /*
  351. * Ensure no single-step breakpoint is pending. Returns non-zero
  352. * value if child was being single-stepped.
  353. */
  354. void ptrace_cancel_bpt(struct task_struct *child)
  355. {
  356. int i, nsaved = child->thread.debug.nsaved;
  357. child->thread.debug.nsaved = 0;
  358. if (nsaved > 2) {
  359. printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
  360. nsaved = 2;
  361. }
  362. for (i = 0; i < nsaved; i++)
  363. clear_breakpoint(child, &child->thread.debug.bp[i]);
  364. }
  365. /*
  366. * Called by kernel/ptrace.c when detaching..
  367. *
  368. * Make sure the single step bit is not set.
  369. */
  370. void ptrace_disable(struct task_struct *child)
  371. {
  372. child->ptrace &= ~PT_SINGLESTEP;
  373. ptrace_cancel_bpt(child);
  374. }
  375. /*
  376. * Handle hitting a breakpoint.
  377. */
  378. void ptrace_break(struct task_struct *tsk, struct pt_regs *regs)
  379. {
  380. siginfo_t info;
  381. /*
  382. * The PC is always left pointing at the next instruction. Fix this.
  383. */
  384. regs->ARM_pc -= 4;
  385. if (tsk->thread.debug.nsaved == 0)
  386. printk(KERN_ERR "ptrace: bogus breakpoint trap\n");
  387. ptrace_cancel_bpt(tsk);
  388. info.si_signo = SIGTRAP;
  389. info.si_errno = 0;
  390. info.si_code = TRAP_BRKPT;
  391. info.si_addr = (void *)instruction_pointer(regs) - 4;
  392. force_sig_info(SIGTRAP, &info, tsk);
  393. }
  394. /*
  395. * Read the word at offset "off" into the "struct user". We
  396. * actually access the pt_regs stored on the kernel stack.
  397. */
  398. static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
  399. unsigned long *ret)
  400. {
  401. unsigned long tmp;
  402. if (off & 3 || off >= sizeof(struct user))
  403. return -EIO;
  404. tmp = 0;
  405. if (off < sizeof(struct pt_regs))
  406. tmp = get_user_reg(tsk, off >> 2);
  407. return put_user(tmp, ret);
  408. }
  409. /*
  410. * Write the word at offset "off" into "struct user". We
  411. * actually access the pt_regs stored on the kernel stack.
  412. */
  413. static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
  414. unsigned long val)
  415. {
  416. if (off & 3 || off >= sizeof(struct user))
  417. return -EIO;
  418. if (off >= sizeof(struct pt_regs))
  419. return 0;
  420. return put_user_reg(tsk, off >> 2, val);
  421. }
  422. /*
  423. * Get all user integer registers.
  424. */
  425. static int ptrace_getregs(struct task_struct *tsk, void *uregs)
  426. {
  427. struct pt_regs *regs = get_user_regs(tsk);
  428. return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
  429. }
  430. /*
  431. * Set all user integer registers.
  432. */
  433. static int ptrace_setregs(struct task_struct *tsk, void *uregs)
  434. {
  435. struct pt_regs newregs;
  436. int ret;
  437. ret = -EFAULT;
  438. if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
  439. struct pt_regs *regs = get_user_regs(tsk);
  440. ret = -EINVAL;
  441. if (valid_user_regs(&newregs)) {
  442. *regs = newregs;
  443. ret = 0;
  444. }
  445. }
  446. return ret;
  447. }
  448. /*
  449. * Get the child FPU state.
  450. */
  451. static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
  452. {
  453. return copy_to_user(ufp, &tsk->thread_info->fpstate,
  454. sizeof(struct user_fp)) ? -EFAULT : 0;
  455. }
  456. /*
  457. * Set the child FPU state.
  458. */
  459. static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
  460. {
  461. set_stopped_child_used_math(tsk);
  462. return copy_from_user(&tsk->thread_info->fpstate, ufp,
  463. sizeof(struct user_fp)) ? -EFAULT : 0;
  464. }
  465. static int do_ptrace(int request, struct task_struct *child, long addr, long data)
  466. {
  467. unsigned long tmp;
  468. int ret;
  469. switch (request) {
  470. /*
  471. * read word at location "addr" in the child process.
  472. */
  473. case PTRACE_PEEKTEXT:
  474. case PTRACE_PEEKDATA:
  475. ret = access_process_vm(child, addr, &tmp,
  476. sizeof(unsigned long), 0);
  477. if (ret == sizeof(unsigned long))
  478. ret = put_user(tmp, (unsigned long *) data);
  479. else
  480. ret = -EIO;
  481. break;
  482. case PTRACE_PEEKUSR:
  483. ret = ptrace_read_user(child, addr, (unsigned long *)data);
  484. break;
  485. /*
  486. * write the word at location addr.
  487. */
  488. case PTRACE_POKETEXT:
  489. case PTRACE_POKEDATA:
  490. ret = access_process_vm(child, addr, &data,
  491. sizeof(unsigned long), 1);
  492. if (ret == sizeof(unsigned long))
  493. ret = 0;
  494. else
  495. ret = -EIO;
  496. break;
  497. case PTRACE_POKEUSR:
  498. ret = ptrace_write_user(child, addr, data);
  499. break;
  500. /*
  501. * continue/restart and stop at next (return from) syscall
  502. */
  503. case PTRACE_SYSCALL:
  504. case PTRACE_CONT:
  505. ret = -EIO;
  506. if (!valid_signal(data))
  507. break;
  508. if (request == PTRACE_SYSCALL)
  509. set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  510. else
  511. clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  512. child->exit_code = data;
  513. /* make sure single-step breakpoint is gone. */
  514. child->ptrace &= ~PT_SINGLESTEP;
  515. ptrace_cancel_bpt(child);
  516. wake_up_process(child);
  517. ret = 0;
  518. break;
  519. /*
  520. * make the child exit. Best I can do is send it a sigkill.
  521. * perhaps it should be put in the status that it wants to
  522. * exit.
  523. */
  524. case PTRACE_KILL:
  525. /* make sure single-step breakpoint is gone. */
  526. child->ptrace &= ~PT_SINGLESTEP;
  527. ptrace_cancel_bpt(child);
  528. if (child->exit_state != EXIT_ZOMBIE) {
  529. child->exit_code = SIGKILL;
  530. wake_up_process(child);
  531. }
  532. ret = 0;
  533. break;
  534. /*
  535. * execute single instruction.
  536. */
  537. case PTRACE_SINGLESTEP:
  538. ret = -EIO;
  539. if (!valid_signal(data))
  540. break;
  541. child->ptrace |= PT_SINGLESTEP;
  542. clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  543. child->exit_code = data;
  544. /* give it a chance to run. */
  545. wake_up_process(child);
  546. ret = 0;
  547. break;
  548. case PTRACE_DETACH:
  549. ret = ptrace_detach(child, data);
  550. break;
  551. case PTRACE_GETREGS:
  552. ret = ptrace_getregs(child, (void *)data);
  553. break;
  554. case PTRACE_SETREGS:
  555. ret = ptrace_setregs(child, (void *)data);
  556. break;
  557. case PTRACE_GETFPREGS:
  558. ret = ptrace_getfpregs(child, (void *)data);
  559. break;
  560. case PTRACE_SETFPREGS:
  561. ret = ptrace_setfpregs(child, (void *)data);
  562. break;
  563. default:
  564. ret = ptrace_request(child, request, addr, data);
  565. break;
  566. }
  567. return ret;
  568. }
  569. asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
  570. {
  571. struct task_struct *child;
  572. int ret;
  573. lock_kernel();
  574. ret = -EPERM;
  575. if (request == PTRACE_TRACEME) {
  576. /* are we already being traced? */
  577. if (current->ptrace & PT_PTRACED)
  578. goto out;
  579. ret = security_ptrace(current->parent, current);
  580. if (ret)
  581. goto out;
  582. /* set the ptrace bit in the process flags. */
  583. current->ptrace |= PT_PTRACED;
  584. ret = 0;
  585. goto out;
  586. }
  587. ret = -ESRCH;
  588. read_lock(&tasklist_lock);
  589. child = find_task_by_pid(pid);
  590. if (child)
  591. get_task_struct(child);
  592. read_unlock(&tasklist_lock);
  593. if (!child)
  594. goto out;
  595. ret = -EPERM;
  596. if (pid == 1) /* you may not mess with init */
  597. goto out_tsk;
  598. if (request == PTRACE_ATTACH) {
  599. ret = ptrace_attach(child);
  600. goto out_tsk;
  601. }
  602. ret = ptrace_check_attach(child, request == PTRACE_KILL);
  603. if (ret == 0)
  604. ret = do_ptrace(request, child, addr, data);
  605. out_tsk:
  606. put_task_struct(child);
  607. out:
  608. unlock_kernel();
  609. return ret;
  610. }
  611. asmlinkage void syscall_trace(int why, struct pt_regs *regs)
  612. {
  613. unsigned long ip;
  614. if (!test_thread_flag(TIF_SYSCALL_TRACE))
  615. return;
  616. if (!(current->ptrace & PT_PTRACED))
  617. return;
  618. /*
  619. * Save IP. IP is used to denote syscall entry/exit:
  620. * IP = 0 -> entry, = 1 -> exit
  621. */
  622. ip = regs->ARM_ip;
  623. regs->ARM_ip = why;
  624. /* the 0x80 provides a way for the tracing parent to distinguish
  625. between a syscall stop and SIGTRAP delivery */
  626. ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
  627. ? 0x80 : 0));
  628. /*
  629. * this isn't the same as continuing with a signal, but it will do
  630. * for normal use. strace only continues with a signal if the
  631. * stopping signal is not SIGTRAP. -brl
  632. */
  633. if (current->exit_code) {
  634. send_sig(current->exit_code, current, 1);
  635. current->exit_code = 0;
  636. }
  637. regs->ARM_ip = ip;
  638. }