Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b659a39 authored by Ralf Baechle's avatar Ralf Baechle
Browse files

MIPS: Split do_syscall_trace into two functions.

parent c19c20ac
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -141,7 +141,8 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
#define instruction_pointer(regs) ((regs)->cp0_epc)
#define instruction_pointer(regs) ((regs)->cp0_epc)
#define profile_pc(regs) instruction_pointer(regs)
#define profile_pc(regs) instruction_pointer(regs)


extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
extern asmlinkage void syscall_trace_enter(struct pt_regs *regs);
extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);


extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET;
extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET;


+2 −3
Original line number Original line Diff line number Diff line
@@ -170,11 +170,10 @@ syscall_exit_work:
	li	t0, _TIF_WORK_SYSCALL_EXIT
	li	t0, _TIF_WORK_SYSCALL_EXIT
	and	t0, a2			# a2 is preloaded with TI_FLAGS
	and	t0, a2			# a2 is preloaded with TI_FLAGS
	beqz	t0, work_pending	# trace bit set?
	beqz	t0, work_pending	# trace bit set?
	local_irq_enable		# could let do_syscall_trace()
	local_irq_enable		# could let syscall_trace_leave()
					# call schedule() instead
					# call schedule() instead
	move	a0, sp
	move	a0, sp
	li	a1, 1
	jal	syscall_trace_leave
	jal	do_syscall_trace
	b	resume_userspace
	b	resume_userspace


#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
+35 −8
Original line number Original line Diff line number Diff line
@@ -533,16 +533,11 @@ static inline int audit_arch(void)
 * Notification of system call entry/exit
 * Notification of system call entry/exit
 * - triggered by current->work.syscall_trace
 * - triggered by current->work.syscall_trace
 */
 */
asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
asmlinkage void syscall_trace_enter(struct pt_regs *regs)
{
{
	/* do the secure computing check first */
	/* do the secure computing check first */
	if (!entryexit)
	secure_computing(regs->regs[2]);
	secure_computing(regs->regs[2]);


	if (unlikely(current->audit_context) && entryexit)
		audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),
		                   -regs->regs[2]);

	if (!(current->ptrace & PT_PTRACED))
	if (!(current->ptrace & PT_PTRACED))
		goto out;
		goto out;


@@ -565,8 +560,40 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
	}
	}


out:
out:
	if (unlikely(current->audit_context) && !entryexit)
	if (unlikely(current->audit_context))
		audit_syscall_entry(audit_arch(), regs->regs[2],
		audit_syscall_entry(audit_arch(), regs->regs[2],
				    regs->regs[4], regs->regs[5],
				    regs->regs[4], regs->regs[5],
				    regs->regs[6], regs->regs[7]);
				    regs->regs[6], regs->regs[7]);
}
}

/*
 * Notification of system call entry/exit
 * - triggered by current->work.syscall_trace
 */
asmlinkage void syscall_trace_leave(struct pt_regs *regs)
{
	if (unlikely(current->audit_context))
		audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),
		                   -regs->regs[2]);

	if (!(current->ptrace & PT_PTRACED))
		return;

	if (!test_thread_flag(TIF_SYSCALL_TRACE))
		return;

	/* The 0x80 provides a way for the tracing parent to distinguish
	   between a syscall stop and SIGTRAP delivery */
	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
	                         0x80 : 0));

	/*
	 * this isn't the same as continuing with a signal, but it will do
	 * for normal use.  strace only continues with a signal if the
	 * stopping signal is not SIGTRAP.  -brl
	 */
	if (current->exit_code) {
		send_sig(current->exit_code, current, 1);
		current->exit_code = 0;
	}
}
+1 −2
Original line number Original line Diff line number Diff line
@@ -88,8 +88,7 @@ syscall_trace_entry:
	SAVE_STATIC
	SAVE_STATIC
	move	s0, t2
	move	s0, t2
	move	a0, sp
	move	a0, sp
	li	a1, 0
	jal	syscall_trace_enter
	jal	do_syscall_trace


	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
+1 −2
Original line number Original line Diff line number Diff line
@@ -91,8 +91,7 @@ syscall_trace_entry:
	SAVE_STATIC
	SAVE_STATIC
	move	s0, t2
	move	s0, t2
	move	a0, sp
	move	a0, sp
	li	a1, 0
	jal	syscall_trace_enter
	jal	do_syscall_trace


	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
Loading