ptrace.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1992 Ross Biro
  7. * Copyright (C) Linus Torvalds
  8. * Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle
  9. * Copyright (C) 1996 David S. Miller
  10. * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
  11. * Copyright (C) 1999 MIPS Technologies, Inc.
  12. * Copyright (C) 2000 Ulf Carlsson
  13. *
  14. * At this time Linux/MIPS64 only supports syscall tracing, even for 32-bit
  15. * binaries.
  16. */
  17. #include <linux/compiler.h>
  18. #include <linux/context_tracking.h>
  19. #include <linux/elf.h>
  20. #include <linux/kernel.h>
  21. #include <linux/sched.h>
  22. #include <linux/mm.h>
  23. #include <linux/errno.h>
  24. #include <linux/ptrace.h>
  25. #include <linux/regset.h>
  26. #include <linux/smp.h>
  27. #include <linux/user.h>
  28. #include <linux/security.h>
  29. #include <linux/tracehook.h>
  30. #include <linux/audit.h>
  31. #include <linux/seccomp.h>
  32. #include <linux/ftrace.h>
  33. #include <asm/byteorder.h>
  34. #include <asm/cpu.h>
  35. #include <asm/dsp.h>
  36. #include <asm/fpu.h>
  37. #include <asm/mipsregs.h>
  38. #include <asm/mipsmtregs.h>
  39. #include <asm/pgtable.h>
  40. #include <asm/page.h>
  41. #include <asm/syscall.h>
  42. #include <asm/uaccess.h>
  43. #include <asm/bootinfo.h>
  44. #include <asm/reg.h>
  45. #define CREATE_TRACE_POINTS
  46. #include <trace/events/syscalls.h>
  47. /*
  48. * Called by kernel/ptrace.c when detaching..
  49. *
  50. * Make sure single step bits etc are not set.
  51. */
  52. void ptrace_disable(struct task_struct *child)
  53. {
  54. /* Don't load the watchpoint registers for the ex-child. */
  55. clear_tsk_thread_flag(child, TIF_LOAD_WATCH);
  56. }
  57. /*
  58. * Read a general register set. We always use the 64-bit format, even
  59. * for 32-bit kernels and for 32-bit processes on a 64-bit kernel.
  60. * Registers are sign extended to fill the available space.
  61. */
  62. int ptrace_getregs(struct task_struct *child, __s64 __user *data)
  63. {
  64. struct pt_regs *regs;
  65. int i;
  66. if (!access_ok(VERIFY_WRITE, data, 38 * 8))
  67. return -EIO;
  68. regs = task_pt_regs(child);
  69. for (i = 0; i < 32; i++)
  70. __put_user((long)regs->regs[i], data + i);
  71. __put_user((long)regs->lo, data + EF_LO - EF_R0);
  72. __put_user((long)regs->hi, data + EF_HI - EF_R0);
  73. __put_user((long)regs->cp0_epc, data + EF_CP0_EPC - EF_R0);
  74. __put_user((long)regs->cp0_badvaddr, data + EF_CP0_BADVADDR - EF_R0);
  75. __put_user((long)regs->cp0_status, data + EF_CP0_STATUS - EF_R0);
  76. __put_user((long)regs->cp0_cause, data + EF_CP0_CAUSE - EF_R0);
  77. return 0;
  78. }
  79. /*
  80. * Write a general register set. As for PTRACE_GETREGS, we always use
  81. * the 64-bit format. On a 32-bit kernel only the lower order half
  82. * (according to endianness) will be used.
  83. */
  84. int ptrace_setregs(struct task_struct *child, __s64 __user *data)
  85. {
  86. struct pt_regs *regs;
  87. int i;
  88. if (!access_ok(VERIFY_READ, data, 38 * 8))
  89. return -EIO;
  90. regs = task_pt_regs(child);
  91. for (i = 0; i < 32; i++)
  92. __get_user(regs->regs[i], data + i);
  93. __get_user(regs->lo, data + EF_LO - EF_R0);
  94. __get_user(regs->hi, data + EF_HI - EF_R0);
  95. __get_user(regs->cp0_epc, data + EF_CP0_EPC - EF_R0);
  96. /* badvaddr, status, and cause may not be written. */
  97. return 0;
  98. }
  99. int ptrace_getfpregs(struct task_struct *child, __u32 __user *data)
  100. {
  101. int i;
  102. if (!access_ok(VERIFY_WRITE, data, 33 * 8))
  103. return -EIO;
  104. if (tsk_used_math(child)) {
  105. union fpureg *fregs = get_fpu_regs(child);
  106. for (i = 0; i < 32; i++)
  107. __put_user(get_fpr64(&fregs[i], 0),
  108. i + (__u64 __user *)data);
  109. } else {
  110. for (i = 0; i < 32; i++)
  111. __put_user((__u64) -1, i + (__u64 __user *) data);
  112. }
  113. __put_user(child->thread.fpu.fcr31, data + 64);
  114. __put_user(current_cpu_data.fpu_id, data + 65);
  115. return 0;
  116. }
  117. int ptrace_setfpregs(struct task_struct *child, __u32 __user *data)
  118. {
  119. union fpureg *fregs;
  120. u64 fpr_val;
  121. int i;
  122. if (!access_ok(VERIFY_READ, data, 33 * 8))
  123. return -EIO;
  124. fregs = get_fpu_regs(child);
  125. for (i = 0; i < 32; i++) {
  126. __get_user(fpr_val, i + (__u64 __user *)data);
  127. set_fpr64(&fregs[i], 0, fpr_val);
  128. }
  129. __get_user(child->thread.fpu.fcr31, data + 64);
  130. child->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
  131. /* FIR may not be written. */
  132. return 0;
  133. }
  134. int ptrace_get_watch_regs(struct task_struct *child,
  135. struct pt_watch_regs __user *addr)
  136. {
  137. enum pt_watch_style style;
  138. int i;
  139. if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
  140. return -EIO;
  141. if (!access_ok(VERIFY_WRITE, addr, sizeof(struct pt_watch_regs)))
  142. return -EIO;
  143. #ifdef CONFIG_32BIT
  144. style = pt_watch_style_mips32;
  145. #define WATCH_STYLE mips32
  146. #else
  147. style = pt_watch_style_mips64;
  148. #define WATCH_STYLE mips64
  149. #endif
  150. __put_user(style, &addr->style);
  151. __put_user(boot_cpu_data.watch_reg_use_cnt,
  152. &addr->WATCH_STYLE.num_valid);
  153. for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
  154. __put_user(child->thread.watch.mips3264.watchlo[i],
  155. &addr->WATCH_STYLE.watchlo[i]);
  156. __put_user(child->thread.watch.mips3264.watchhi[i] & 0xfff,
  157. &addr->WATCH_STYLE.watchhi[i]);
  158. __put_user(boot_cpu_data.watch_reg_masks[i],
  159. &addr->WATCH_STYLE.watch_masks[i]);
  160. }
  161. for (; i < 8; i++) {
  162. __put_user(0, &addr->WATCH_STYLE.watchlo[i]);
  163. __put_user(0, &addr->WATCH_STYLE.watchhi[i]);
  164. __put_user(0, &addr->WATCH_STYLE.watch_masks[i]);
  165. }
  166. return 0;
  167. }
  168. int ptrace_set_watch_regs(struct task_struct *child,
  169. struct pt_watch_regs __user *addr)
  170. {
  171. int i;
  172. int watch_active = 0;
  173. unsigned long lt[NUM_WATCH_REGS];
  174. u16 ht[NUM_WATCH_REGS];
  175. if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
  176. return -EIO;
  177. if (!access_ok(VERIFY_READ, addr, sizeof(struct pt_watch_regs)))
  178. return -EIO;
  179. /* Check the values. */
  180. for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
  181. __get_user(lt[i], &addr->WATCH_STYLE.watchlo[i]);
  182. #ifdef CONFIG_32BIT
  183. if (lt[i] & __UA_LIMIT)
  184. return -EINVAL;
  185. #else
  186. if (test_tsk_thread_flag(child, TIF_32BIT_ADDR)) {
  187. if (lt[i] & 0xffffffff80000000UL)
  188. return -EINVAL;
  189. } else {
  190. if (lt[i] & __UA_LIMIT)
  191. return -EINVAL;
  192. }
  193. #endif
  194. __get_user(ht[i], &addr->WATCH_STYLE.watchhi[i]);
  195. if (ht[i] & ~0xff8)
  196. return -EINVAL;
  197. }
  198. /* Install them. */
  199. for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
  200. if (lt[i] & 7)
  201. watch_active = 1;
  202. child->thread.watch.mips3264.watchlo[i] = lt[i];
  203. /* Set the G bit. */
  204. child->thread.watch.mips3264.watchhi[i] = ht[i];
  205. }
  206. if (watch_active)
  207. set_tsk_thread_flag(child, TIF_LOAD_WATCH);
  208. else
  209. clear_tsk_thread_flag(child, TIF_LOAD_WATCH);
  210. return 0;
  211. }
  212. /* regset get/set implementations */
  213. static int gpr_get(struct task_struct *target,
  214. const struct user_regset *regset,
  215. unsigned int pos, unsigned int count,
  216. void *kbuf, void __user *ubuf)
  217. {
  218. struct pt_regs *regs = task_pt_regs(target);
  219. return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
  220. regs, 0, sizeof(*regs));
  221. }
  222. static int gpr_set(struct task_struct *target,
  223. const struct user_regset *regset,
  224. unsigned int pos, unsigned int count,
  225. const void *kbuf, const void __user *ubuf)
  226. {
  227. struct pt_regs newregs;
  228. int ret;
  229. ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
  230. &newregs,
  231. 0, sizeof(newregs));
  232. if (ret)
  233. return ret;
  234. *task_pt_regs(target) = newregs;
  235. return 0;
  236. }
  237. static int fpr_get(struct task_struct *target,
  238. const struct user_regset *regset,
  239. unsigned int pos, unsigned int count,
  240. void *kbuf, void __user *ubuf)
  241. {
  242. unsigned i;
  243. int err;
  244. u64 fpr_val;
  245. /* XXX fcr31 */
  246. if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))
  247. return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
  248. &target->thread.fpu,
  249. 0, sizeof(elf_fpregset_t));
  250. for (i = 0; i < NUM_FPU_REGS; i++) {
  251. fpr_val = get_fpr64(&target->thread.fpu.fpr[i], 0);
  252. err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
  253. &fpr_val, i * sizeof(elf_fpreg_t),
  254. (i + 1) * sizeof(elf_fpreg_t));
  255. if (err)
  256. return err;
  257. }
  258. return 0;
  259. }
  260. static int fpr_set(struct task_struct *target,
  261. const struct user_regset *regset,
  262. unsigned int pos, unsigned int count,
  263. const void *kbuf, const void __user *ubuf)
  264. {
  265. unsigned i;
  266. int err;
  267. u64 fpr_val;
  268. /* XXX fcr31 */
  269. if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))
  270. return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
  271. &target->thread.fpu,
  272. 0, sizeof(elf_fpregset_t));
  273. for (i = 0; i < NUM_FPU_REGS; i++) {
  274. err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
  275. &fpr_val, i * sizeof(elf_fpreg_t),
  276. (i + 1) * sizeof(elf_fpreg_t));
  277. if (err)
  278. return err;
  279. set_fpr64(&target->thread.fpu.fpr[i], 0, fpr_val);
  280. }
  281. return 0;
  282. }
  283. enum mips_regset {
  284. REGSET_GPR,
  285. REGSET_FPR,
  286. };
  287. static const struct user_regset mips_regsets[] = {
  288. [REGSET_GPR] = {
  289. .core_note_type = NT_PRSTATUS,
  290. .n = ELF_NGREG,
  291. .size = sizeof(unsigned int),
  292. .align = sizeof(unsigned int),
  293. .get = gpr_get,
  294. .set = gpr_set,
  295. },
  296. [REGSET_FPR] = {
  297. .core_note_type = NT_PRFPREG,
  298. .n = ELF_NFPREG,
  299. .size = sizeof(elf_fpreg_t),
  300. .align = sizeof(elf_fpreg_t),
  301. .get = fpr_get,
  302. .set = fpr_set,
  303. },
  304. };
  305. static const struct user_regset_view user_mips_view = {
  306. .name = "mips",
  307. .e_machine = ELF_ARCH,
  308. .ei_osabi = ELF_OSABI,
  309. .regsets = mips_regsets,
  310. .n = ARRAY_SIZE(mips_regsets),
  311. };
  312. static const struct user_regset mips64_regsets[] = {
  313. [REGSET_GPR] = {
  314. .core_note_type = NT_PRSTATUS,
  315. .n = ELF_NGREG,
  316. .size = sizeof(unsigned long),
  317. .align = sizeof(unsigned long),
  318. .get = gpr_get,
  319. .set = gpr_set,
  320. },
  321. [REGSET_FPR] = {
  322. .core_note_type = NT_PRFPREG,
  323. .n = ELF_NFPREG,
  324. .size = sizeof(elf_fpreg_t),
  325. .align = sizeof(elf_fpreg_t),
  326. .get = fpr_get,
  327. .set = fpr_set,
  328. },
  329. };
  330. static const struct user_regset_view user_mips64_view = {
  331. .name = "mips",
  332. .e_machine = ELF_ARCH,
  333. .ei_osabi = ELF_OSABI,
  334. .regsets = mips64_regsets,
  335. .n = ARRAY_SIZE(mips_regsets),
  336. };
  337. const struct user_regset_view *task_user_regset_view(struct task_struct *task)
  338. {
  339. #ifdef CONFIG_32BIT
  340. return &user_mips_view;
  341. #endif
  342. #ifdef CONFIG_MIPS32_O32
  343. if (test_thread_flag(TIF_32BIT_REGS))
  344. return &user_mips_view;
  345. #endif
  346. return &user_mips64_view;
  347. }
  348. long arch_ptrace(struct task_struct *child, long request,
  349. unsigned long addr, unsigned long data)
  350. {
  351. int ret;
  352. void __user *addrp = (void __user *) addr;
  353. void __user *datavp = (void __user *) data;
  354. unsigned long __user *datalp = (void __user *) data;
  355. switch (request) {
  356. /* when I and D space are separate, these will need to be fixed. */
  357. case PTRACE_PEEKTEXT: /* read word at location addr. */
  358. case PTRACE_PEEKDATA:
  359. ret = generic_ptrace_peekdata(child, addr, data);
  360. break;
  361. /* Read the word at location addr in the USER area. */
  362. case PTRACE_PEEKUSR: {
  363. struct pt_regs *regs;
  364. union fpureg *fregs;
  365. unsigned long tmp = 0;
  366. regs = task_pt_regs(child);
  367. ret = 0; /* Default return value. */
  368. switch (addr) {
  369. case 0 ... 31:
  370. tmp = regs->regs[addr];
  371. break;
  372. case FPR_BASE ... FPR_BASE + 31:
  373. if (!tsk_used_math(child)) {
  374. /* FP not yet used */
  375. tmp = -1;
  376. break;
  377. }
  378. fregs = get_fpu_regs(child);
  379. #ifdef CONFIG_32BIT
  380. if (test_thread_flag(TIF_32BIT_FPREGS)) {
  381. /*
  382. * The odd registers are actually the high
  383. * order bits of the values stored in the even
  384. * registers - unless we're using r2k_switch.S.
  385. */
  386. tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE],
  387. addr & 1);
  388. break;
  389. }
  390. #endif
  391. tmp = get_fpr32(&fregs[addr - FPR_BASE], 0);
  392. break;
  393. case PC:
  394. tmp = regs->cp0_epc;
  395. break;
  396. case CAUSE:
  397. tmp = regs->cp0_cause;
  398. break;
  399. case BADVADDR:
  400. tmp = regs->cp0_badvaddr;
  401. break;
  402. case MMHI:
  403. tmp = regs->hi;
  404. break;
  405. case MMLO:
  406. tmp = regs->lo;
  407. break;
  408. #ifdef CONFIG_CPU_HAS_SMARTMIPS
  409. case ACX:
  410. tmp = regs->acx;
  411. break;
  412. #endif
  413. case FPC_CSR:
  414. tmp = child->thread.fpu.fcr31;
  415. break;
  416. case FPC_EIR:
  417. /* implementation / version register */
  418. tmp = current_cpu_data.fpu_id;
  419. break;
  420. case DSP_BASE ... DSP_BASE + 5: {
  421. dspreg_t *dregs;
  422. if (!cpu_has_dsp) {
  423. tmp = 0;
  424. ret = -EIO;
  425. goto out;
  426. }
  427. dregs = __get_dsp_regs(child);
  428. tmp = (unsigned long) (dregs[addr - DSP_BASE]);
  429. break;
  430. }
  431. case DSP_CONTROL:
  432. if (!cpu_has_dsp) {
  433. tmp = 0;
  434. ret = -EIO;
  435. goto out;
  436. }
  437. tmp = child->thread.dsp.dspcontrol;
  438. break;
  439. default:
  440. tmp = 0;
  441. ret = -EIO;
  442. goto out;
  443. }
  444. ret = put_user(tmp, datalp);
  445. break;
  446. }
  447. /* when I and D space are separate, this will have to be fixed. */
  448. case PTRACE_POKETEXT: /* write the word at location addr. */
  449. case PTRACE_POKEDATA:
  450. ret = generic_ptrace_pokedata(child, addr, data);
  451. break;
  452. case PTRACE_POKEUSR: {
  453. struct pt_regs *regs;
  454. ret = 0;
  455. regs = task_pt_regs(child);
  456. switch (addr) {
  457. case 0 ... 31:
  458. regs->regs[addr] = data;
  459. break;
  460. case FPR_BASE ... FPR_BASE + 31: {
  461. union fpureg *fregs = get_fpu_regs(child);
  462. if (!tsk_used_math(child)) {
  463. /* FP not yet used */
  464. memset(&child->thread.fpu, ~0,
  465. sizeof(child->thread.fpu));
  466. child->thread.fpu.fcr31 = 0;
  467. }
  468. #ifdef CONFIG_32BIT
  469. if (test_thread_flag(TIF_32BIT_FPREGS)) {
  470. /*
  471. * The odd registers are actually the high
  472. * order bits of the values stored in the even
  473. * registers - unless we're using r2k_switch.S.
  474. */
  475. set_fpr32(&fregs[(addr & ~1) - FPR_BASE],
  476. addr & 1, data);
  477. break;
  478. }
  479. #endif
  480. set_fpr64(&fregs[addr - FPR_BASE], 0, data);
  481. break;
  482. }
  483. case PC:
  484. regs->cp0_epc = data;
  485. break;
  486. case MMHI:
  487. regs->hi = data;
  488. break;
  489. case MMLO:
  490. regs->lo = data;
  491. break;
  492. #ifdef CONFIG_CPU_HAS_SMARTMIPS
  493. case ACX:
  494. regs->acx = data;
  495. break;
  496. #endif
  497. case FPC_CSR:
  498. child->thread.fpu.fcr31 = data & ~FPU_CSR_ALL_X;
  499. break;
  500. case DSP_BASE ... DSP_BASE + 5: {
  501. dspreg_t *dregs;
  502. if (!cpu_has_dsp) {
  503. ret = -EIO;
  504. break;
  505. }
  506. dregs = __get_dsp_regs(child);
  507. dregs[addr - DSP_BASE] = data;
  508. break;
  509. }
  510. case DSP_CONTROL:
  511. if (!cpu_has_dsp) {
  512. ret = -EIO;
  513. break;
  514. }
  515. child->thread.dsp.dspcontrol = data;
  516. break;
  517. default:
  518. /* The rest are not allowed. */
  519. ret = -EIO;
  520. break;
  521. }
  522. break;
  523. }
  524. case PTRACE_GETREGS:
  525. ret = ptrace_getregs(child, datavp);
  526. break;
  527. case PTRACE_SETREGS:
  528. ret = ptrace_setregs(child, datavp);
  529. break;
  530. case PTRACE_GETFPREGS:
  531. ret = ptrace_getfpregs(child, datavp);
  532. break;
  533. case PTRACE_SETFPREGS:
  534. ret = ptrace_setfpregs(child, datavp);
  535. break;
  536. case PTRACE_GET_THREAD_AREA:
  537. ret = put_user(task_thread_info(child)->tp_value, datalp);
  538. break;
  539. case PTRACE_GET_WATCH_REGS:
  540. ret = ptrace_get_watch_regs(child, addrp);
  541. break;
  542. case PTRACE_SET_WATCH_REGS:
  543. ret = ptrace_set_watch_regs(child, addrp);
  544. break;
  545. default:
  546. ret = ptrace_request(child, request, addr, data);
  547. break;
  548. }
  549. out:
  550. return ret;
  551. }
  552. /*
  553. * Notification of system call entry/exit
  554. * - triggered by current->work.syscall_trace
  555. */
  556. asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
  557. {
  558. long ret = 0;
  559. user_exit();
  560. if (secure_computing(syscall) == -1)
  561. return -1;
  562. if (test_thread_flag(TIF_SYSCALL_TRACE) &&
  563. tracehook_report_syscall_entry(regs))
  564. ret = -1;
  565. if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
  566. trace_sys_enter(regs, regs->regs[2]);
  567. audit_syscall_entry(syscall_get_arch(),
  568. syscall,
  569. regs->regs[4], regs->regs[5],
  570. regs->regs[6], regs->regs[7]);
  571. return syscall;
  572. }
  573. /*
  574. * Notification of system call entry/exit
  575. * - triggered by current->work.syscall_trace
  576. */
  577. asmlinkage void syscall_trace_leave(struct pt_regs *regs)
  578. {
  579. /*
  580. * We may come here right after calling schedule_user()
  581. * or do_notify_resume(), in which case we can be in RCU
  582. * user mode.
  583. */
  584. user_exit();
  585. audit_syscall_exit(regs);
  586. if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
  587. trace_sys_exit(regs, regs->regs[2]);
  588. if (test_thread_flag(TIF_SYSCALL_TRACE))
  589. tracehook_report_syscall_exit(regs, 0);
  590. user_enter();
  591. }