···170170 li t0, _TIF_WORK_SYSCALL_EXIT171171 and t0, a2 # a2 is preloaded with TI_FLAGS172172 beqz t0, work_pending # trace bit set?173173- local_irq_enable # could let do_syscall_trace()173173+ local_irq_enable # could let syscall_trace_leave()174174 # call schedule() instead175175 move a0, sp176176- li a1, 1177177- jal do_syscall_trace176176+ jal syscall_trace_leave178177 b resume_userspace179178180179#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
+35-8
arch/mips/kernel/ptrace.c
···533533 * Notification of system call entry/exit534534 * - triggered by current->work.syscall_trace535535 */536536-asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)536536+asmlinkage void syscall_trace_enter(struct pt_regs *regs)537537{538538 /* do the secure computing check first */539539- if (!entryexit)540540- secure_computing(regs->regs[2]);541541-542542- if (unlikely(current->audit_context) && entryexit)543543- audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),544544- -regs->regs[2]);539539+ secure_computing(regs->regs[2]);545540546541 if (!(current->ptrace & PT_PTRACED))547542 goto out;···560565 }561566562567out:563563- if (unlikely(current->audit_context) && !entryexit)568568+ if (unlikely(current->audit_context))564569 audit_syscall_entry(audit_arch(), regs->regs[2],565570 regs->regs[4], regs->regs[5],566571 regs->regs[6], regs->regs[7]);572572+}573573+574574+/*575575+ * Notification of system call entry/exit576576+ * - triggered by current->work.syscall_trace577577+ */578578+asmlinkage void syscall_trace_leave(struct pt_regs *regs)579579+{580580+ if (unlikely(current->audit_context))581581+ audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),582582+ -regs->regs[2]);583583+584584+ if (!(current->ptrace & PT_PTRACED))585585+ return;586586+587587+ if (!test_thread_flag(TIF_SYSCALL_TRACE))588588+ return;589589+590590+ /* The 0x80 provides a way for the tracing parent to distinguish591591+ between a syscall stop and SIGTRAP delivery */592592+ ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?593593+ 0x80 : 0));594594+595595+ /*596596+ * this isn't the same as continuing with a signal, but it will do597597+ * for normal use. strace only continues with a signal if the598598+ * stopping signal is not SIGTRAP. -brl599599+ */600600+ if (current->exit_code) {601601+ send_sig(current->exit_code, current, 1);602602+ current->exit_code = 0;603603+ }567604}