diff options
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/ptrace.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 92f2c39afe27..eaf7be9d0b0a 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -300,25 +300,38 @@ out: | |||
300 | return ret; | 300 | return ret; |
301 | } | 301 | } |
302 | 302 | ||
303 | static inline int audit_arch() | ||
304 | { | ||
305 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
306 | #ifdef CONFIG_MIPS64 | ||
307 | if (!(current->thread.mflags & MF_32BIT_REGS)) | ||
308 | return AUDIT_ARCH_MIPSEL64; | ||
309 | #endif /* MIPS64 */ | ||
310 | return AUDIT_ARCH_MIPSEL; | ||
311 | |||
312 | #else /* big endian... */ | ||
313 | #ifdef CONFIG_MIPS64 | ||
314 | if (!(current->thread.mflags & MF_32BIT_REGS)) | ||
315 | return AUDIT_ARCH_MIPS64; | ||
316 | #endif /* MIPS64 */ | ||
317 | return AUDIT_ARCH_MIPS; | ||
318 | |||
319 | #endif /* endian */ | ||
320 | } | ||
321 | |||
303 | /* | 322 | /* |
304 | * Notification of system call entry/exit | 323 | * Notification of system call entry/exit |
305 | * - triggered by current->work.syscall_trace | 324 | * - triggered by current->work.syscall_trace |
306 | */ | 325 | */ |
307 | asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) | 326 | asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) |
308 | { | 327 | { |
309 | if (unlikely(current->audit_context)) { | 328 | if (unlikely(current->audit_context) && entryexit) |
310 | if (!entryexit) | 329 | audit_syscall_exit(current, AUDITSC_RESULT(regs->regs[2]), regs->regs[2]); |
311 | audit_syscall_entry(current, regs->regs[2], | ||
312 | regs->regs[4], regs->regs[5], | ||
313 | regs->regs[6], regs->regs[7]); | ||
314 | else | ||
315 | audit_syscall_exit(current, regs->regs[2]); | ||
316 | } | ||
317 | 330 | ||
318 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 331 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
319 | return; | 332 | goto out; |
320 | if (!(current->ptrace & PT_PTRACED)) | 333 | if (!(current->ptrace & PT_PTRACED)) |
321 | return; | 334 | goto out; |
322 | 335 | ||
323 | /* The 0x80 provides a way for the tracing parent to distinguish | 336 | /* The 0x80 provides a way for the tracing parent to distinguish |
324 | between a syscall stop and SIGTRAP delivery */ | 337 | between a syscall stop and SIGTRAP delivery */ |
@@ -334,4 +347,9 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) | |||
334 | send_sig(current->exit_code, current, 1); | 347 | send_sig(current->exit_code, current, 1); |
335 | current->exit_code = 0; | 348 | current->exit_code = 0; |
336 | } | 349 | } |
350 | out: | ||
351 | if (unlikely(current->audit_context) && !entryexit) | ||
352 | audit_syscall_entry(current, audit_arch(), regs->regs[2], | ||
353 | regs->regs[4], regs->regs[5], | ||
354 | regs->regs[6], regs->regs[7]); | ||
337 | } | 355 | } |