Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Split do_syscall_trace into two functions.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

+43 -20
+2 -1
arch/mips/include/asm/ptrace.h
··· 141 141 #define instruction_pointer(regs) ((regs)->cp0_epc) 142 142 #define profile_pc(regs) instruction_pointer(regs) 143 143 144 - extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); 144 + extern asmlinkage void syscall_trace_enter(struct pt_regs *regs); 145 + extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); 145 146 146 147 extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET; 147 148
+2 -3
arch/mips/kernel/entry.S
··· 170 170 li t0, _TIF_WORK_SYSCALL_EXIT 171 171 and t0, a2 # a2 is preloaded with TI_FLAGS 172 172 beqz t0, work_pending # trace bit set? 173 - local_irq_enable # could let do_syscall_trace() 173 + local_irq_enable # could let syscall_trace_leave() 174 174 # call schedule() instead 175 175 move a0, sp 176 - li a1, 1 177 - jal do_syscall_trace 176 + jal syscall_trace_leave 178 177 b resume_userspace 179 178 180 179 #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
+35 -8
arch/mips/kernel/ptrace.c
··· 533 533 * Notification of system call entry/exit 534 534 * - triggered by current->work.syscall_trace 535 535 */ 536 - asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) 536 + asmlinkage void syscall_trace_enter(struct pt_regs *regs) 537 537 { 538 538 /* do the secure computing check first */ 539 - if (!entryexit) 540 - secure_computing(regs->regs[2]); 541 - 542 - if (unlikely(current->audit_context) && entryexit) 543 - audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]), 544 - -regs->regs[2]); 539 + secure_computing(regs->regs[2]); 545 540 546 541 if (!(current->ptrace & PT_PTRACED)) 547 542 goto out; ··· 560 565 } 561 566 562 567 out: 563 - if (unlikely(current->audit_context) && !entryexit) 568 + if (unlikely(current->audit_context)) 564 569 audit_syscall_entry(audit_arch(), regs->regs[2], 565 570 regs->regs[4], regs->regs[5], 566 571 regs->regs[6], regs->regs[7]); 572 + } 573 + 574 + /* 575 + * Notification of system call entry/exit 576 + * - triggered by current->work.syscall_trace 577 + */ 578 + asmlinkage void syscall_trace_leave(struct pt_regs *regs) 579 + { 580 + if (unlikely(current->audit_context)) 581 + audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]), 582 + -regs->regs[2]); 583 + 584 + if (!(current->ptrace & PT_PTRACED)) 585 + return; 586 + 587 + if (!test_thread_flag(TIF_SYSCALL_TRACE)) 588 + return; 589 + 590 + /* The 0x80 provides a way for the tracing parent to distinguish 591 + between a syscall stop and SIGTRAP delivery */ 592 + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 593 + 0x80 : 0)); 594 + 595 + /* 596 + * this isn't the same as continuing with a signal, but it will do 597 + * for normal use. strace only continues with a signal if the 598 + * stopping signal is not SIGTRAP. -brl 599 + */ 600 + if (current->exit_code) { 601 + send_sig(current->exit_code, current, 1); 602 + current->exit_code = 0; 603 + } 567 604 }
+1 -2
arch/mips/kernel/scall32-o32.S
··· 88 88 SAVE_STATIC 89 89 move s0, t2 90 90 move a0, sp 91 - li a1, 0 92 - jal do_syscall_trace 91 + jal syscall_trace_enter 93 92 94 93 move t0, s0 95 94 RESTORE_STATIC
+1 -2
arch/mips/kernel/scall64-64.S
··· 91 91 SAVE_STATIC 92 92 move s0, t2 93 93 move a0, sp 94 - li a1, 0 95 - jal do_syscall_trace 94 + jal syscall_trace_enter 96 95 97 96 move t0, s0 98 97 RESTORE_STATIC
+1 -2
arch/mips/kernel/scall64-n32.S
··· 89 89 SAVE_STATIC 90 90 move s0, t2 91 91 move a0, sp 92 - li a1, 0 93 - jal do_syscall_trace 92 + jal syscall_trace_enter 94 93 95 94 move t0, s0 96 95 RESTORE_STATIC
+1 -2
arch/mips/kernel/scall64-o32.S
··· 123 123 124 124 move s0, t2 # Save syscall pointer 125 125 move a0, sp 126 - li a1, 0 127 - jal do_syscall_trace 126 + jal syscall_trace_enter 128 127 129 128 move t0, s0 130 129 RESTORE_STATIC