sparc64: Split syscall_trace() into two functions.
Christoph Hellwig noticed that having both entry and exit logic in one function no longer makes sense, and having seperate ones simplifies things a lot. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
15df0f3302
commit
fe06ccaad2
|
@ -22,7 +22,8 @@ extern void do_notify_resume(struct pt_regs *regs,
|
|||
unsigned long orig_i0,
|
||||
unsigned long thread_info_flags);
|
||||
|
||||
extern asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
|
||||
extern asmlinkage int syscall_trace_enter(struct pt_regs *regs);
|
||||
extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
|
||||
|
||||
extern void bad_trap_tl1(struct pt_regs *regs, long lvl);
|
||||
|
||||
|
|
|
@ -1050,31 +1050,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
|
||||
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
/* do the secure computing check first */
|
||||
secure_computing(regs->u_regs[UREG_G1]);
|
||||
|
||||
if (unlikely(current->audit_context) && syscall_exit_p) {
|
||||
unsigned long tstate = regs->tstate;
|
||||
int result = AUDITSC_SUCCESS;
|
||||
if (test_thread_flag(TIF_SYSCALL_TRACE))
|
||||
ret = tracehook_report_syscall_entry(regs);
|
||||
|
||||
if (unlikely(tstate & (TSTATE_XCARRY | TSTATE_ICARRY)))
|
||||
result = AUDITSC_FAILURE;
|
||||
|
||||
audit_syscall_exit(result, regs->u_regs[UREG_I0]);
|
||||
}
|
||||
|
||||
if (test_thread_flag(TIF_SYSCALL_TRACE)) {
|
||||
if (syscall_exit_p)
|
||||
tracehook_report_syscall_exit(regs, 0);
|
||||
else
|
||||
ret = tracehook_report_syscall_entry(regs);
|
||||
}
|
||||
|
||||
if (unlikely(current->audit_context) && !syscall_exit_p && !ret)
|
||||
if (unlikely(current->audit_context) && !ret)
|
||||
audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
|
||||
AUDIT_ARCH_SPARC :
|
||||
AUDIT_ARCH_SPARC64),
|
||||
|
@ -1086,3 +1072,19 @@ asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
asmlinkage void syscall_trace_leave(struct pt_regs *regs)
|
||||
{
|
||||
if (unlikely(current->audit_context)) {
|
||||
unsigned long tstate = regs->tstate;
|
||||
int result = AUDITSC_SUCCESS;
|
||||
|
||||
if (unlikely(tstate & (TSTATE_XCARRY | TSTATE_ICARRY)))
|
||||
result = AUDITSC_FAILURE;
|
||||
|
||||
audit_syscall_exit(result, regs->u_regs[UREG_I0]);
|
||||
}
|
||||
|
||||
if (test_thread_flag(TIF_SYSCALL_TRACE))
|
||||
tracehook_report_syscall_exit(regs, 0);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ extern void *__memscan_zero(void *, size_t);
|
|||
extern void *__memscan_generic(void *, int, size_t);
|
||||
extern int __memcmp(const void *, const void *, __kernel_size_t);
|
||||
extern __kernel_size_t strlen(const char *);
|
||||
extern void syscall_trace(struct pt_regs *, int);
|
||||
extern void sys_sigsuspend(void);
|
||||
extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
|
||||
extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *);
|
||||
|
|
|
@ -65,9 +65,8 @@ sys32_rt_sigreturn:
|
|||
andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
|
||||
be,pt %icc, rtrap
|
||||
nop
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
call syscall_trace
|
||||
mov 1, %o1
|
||||
call syscall_trace_leave
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
ba,pt %xcc, rtrap
|
||||
nop
|
||||
|
||||
|
@ -159,9 +158,8 @@ linux_sparc_ni_syscall:
|
|||
or %l7, %lo(sys_ni_syscall), %l7
|
||||
|
||||
linux_syscall_trace32:
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
call syscall_trace
|
||||
clr %o1
|
||||
call syscall_trace_enter
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
brnz,pn %o0, 3f
|
||||
mov -ENOSYS, %o0
|
||||
srl %i0, 0, %o0
|
||||
|
@ -172,9 +170,8 @@ linux_syscall_trace32:
|
|||
srl %i3, 0, %o3
|
||||
|
||||
linux_syscall_trace:
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
call syscall_trace
|
||||
clr %o1
|
||||
call syscall_trace_enter
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
brnz,pn %o0, 3f
|
||||
mov -ENOSYS, %o0
|
||||
mov %i0, %o0
|
||||
|
@ -275,9 +272,8 @@ ret_sys_call:
|
|||
b,pt %xcc, rtrap
|
||||
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
|
||||
linux_syscall_trace2:
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
call syscall_trace
|
||||
mov 1, %o1
|
||||
call syscall_trace_leave
|
||||
add %sp, PTREGS_OFF, %o0
|
||||
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
|
||||
ba,pt %xcc, rtrap
|
||||
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
|
||||
|
|
Loading…
Reference in New Issue