Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245297
b: refs/heads/master
c: 8b659a3
h: refs/heads/master
i:
  245295: eb4651e
v: v3
  • Loading branch information
Ralf Baechle committed May 19, 2011
1 parent 07c353d commit 34ebe8e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c19c20ac6338435469a2c222ef5dc55e0469a6dc
refs/heads/master: 8b659a393171aed3dafa1d7455ac9eec1f3ed315
3 changes: 2 additions & 1 deletion trunk/arch/mips/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
#define instruction_pointer(regs) ((regs)->cp0_epc)
#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;

Expand Down
5 changes: 2 additions & 3 deletions trunk/arch/mips/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ syscall_exit_work:
li t0, _TIF_WORK_SYSCALL_EXIT
and t0, a2 # a2 is preloaded with TI_FLAGS
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
move a0, sp
li a1, 1
jal do_syscall_trace
jal syscall_trace_leave
b resume_userspace

#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)
Expand Down
43 changes: 35 additions & 8 deletions trunk/arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,10 @@ static inline int audit_arch(void)
* Notification of system call entry/exit
* - 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 */
if (!entryexit)
secure_computing(regs->regs[2]);

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

if (!(current->ptrace & PT_PTRACED))
goto out;
Expand All @@ -565,8 +560,40 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
}

out:
if (unlikely(current->audit_context) && !entryexit)
if (unlikely(current->audit_context))
audit_syscall_entry(audit_arch(), regs->regs[2],
regs->regs[4], regs->regs[5],
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;
}
}
3 changes: 1 addition & 2 deletions trunk/arch/mips/kernel/scall32-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ syscall_trace_entry:
SAVE_STATIC
move s0, t2
move a0, sp
li a1, 0
jal do_syscall_trace
jal syscall_trace_enter

move t0, s0
RESTORE_STATIC
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/mips/kernel/scall64-64.S
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ syscall_trace_entry:
SAVE_STATIC
move s0, t2
move a0, sp
li a1, 0
jal do_syscall_trace
jal syscall_trace_enter

move t0, s0
RESTORE_STATIC
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/mips/kernel/scall64-n32.S
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ n32_syscall_trace_entry:
SAVE_STATIC
move s0, t2
move a0, sp
li a1, 0
jal do_syscall_trace
jal syscall_trace_enter

move t0, s0
RESTORE_STATIC
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/mips/kernel/scall64-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ trace_a_syscall:

move s0, t2 # Save syscall pointer
move a0, sp
li a1, 0
jal do_syscall_trace
jal syscall_trace_enter

move t0, s0
RESTORE_STATIC
Expand Down

0 comments on commit 34ebe8e

Please sign in to comment.