ptrace.c 16 KB

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