ptrace.c 16 KB

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