Skip to content

Commit

Permalink
MIPS: Move audit_arch() helper function to __syscall_get_arch().
Browse files Browse the repository at this point in the history
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Oct 29, 2013
1 parent c0ff3c5 commit bec9b2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
14 changes: 14 additions & 0 deletions arch/mips/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef __ASM_MIPS_SYSCALL_H
#define __ASM_MIPS_SYSCALL_H

#include <linux/audit.h>
#include <linux/elf-em.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -80,4 +82,16 @@ extern const unsigned long sys_call_table[];
extern const unsigned long sys32_call_table[];
extern const unsigned long sysn32_call_table[];

static inline int __syscall_get_arch(void)
{
int arch = EM_MIPS;
#ifdef CONFIG_64BIT
arch |= __AUDIT_ARCH_64BIT;
#endif
#if defined(__LITTLE_ENDIAN)
arch |= __AUDIT_ARCH_LE;
#endif
return arch;
}

#endif /* __ASM_MIPS_SYSCALL_H */
16 changes: 3 additions & 13 deletions arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <asm/mipsmtregs.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/syscall.h>
#include <asm/uaccess.h>
#include <asm/bootinfo.h>
#include <asm/reg.h>
Expand Down Expand Up @@ -647,18 +648,6 @@ long arch_ptrace(struct task_struct *child, long request,
return ret;
}

static inline int audit_arch(void)
{
int arch = EM_MIPS;
#ifdef CONFIG_64BIT
arch |= __AUDIT_ARCH_64BIT;
#endif
#if defined(__LITTLE_ENDIAN)
arch |= __AUDIT_ARCH_LE;
#endif
return arch;
}

/*
* Notification of system call entry/exit
* - triggered by current->work.syscall_trace
Expand All @@ -673,7 +662,8 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
if (test_thread_flag(TIF_SYSCALL_TRACE))
ptrace_report_syscall(regs);

audit_syscall_entry(audit_arch(), regs->regs[2],
audit_syscall_entry(__syscall_get_arch(),
regs->regs[2],
regs->regs[4], regs->regs[5],
regs->regs[6], regs->regs[7]);
}
Expand Down

0 comments on commit bec9b2b

Please sign in to comment.