summaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-07-30 15:05:35 +0400
committerPaul Mundt <lethal@linux-sh.org>2008-08-01 23:39:33 +0400
commit9e5e21170e4de269cd5b9d53ac9d60d220e3be63 (patch)
treed719e40aa41897b306c4925c37a0d83579966a87 /arch/sh
parentab99c733ae73cce31f2a2434f7099564e5a73d95 (diff)
downloadlinux-9e5e21170e4de269cd5b9d53ac9d60d220e3be63.tar.xz
sh: Fix up the audit arch endian specification.
Presently this was always being set to AUDIT_ARCH_SH, which assumes big endian. Fix this up so that the architecture actually reflects what we're running on. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/ptrace_32.c13
-rw-r--r--arch/sh/kernel/ptrace_64.c16
2 files changed, 27 insertions, 2 deletions
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index f48769b23bd6..035cb300d3dc 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -217,6 +217,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
return ret;
}
+static inline int audit_arch(void)
+{
+ int arch = EM_SH;
+
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+ arch |= __AUDIT_ARCH_LE;
+#endif
+
+ return arch;
+}
+
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;
@@ -233,7 +244,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
ret = -1L;
if (unlikely(current->audit_context))
- audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3],
+ audit_syscall_entry(audit_arch(), regs->regs[3],
regs->regs[4], regs->regs[5],
regs->regs[6], regs->regs[7]);
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 236d8bef9ccd..5922edd416db 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -222,6 +222,20 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
return sys_ptrace(request, pid, addr, data);
}
+static inline int audit_arch(void)
+{
+ int arch = EM_SH;
+
+#ifdef CONFIG_64BIT
+ arch |= __AUDIT_ARCH_64BIT;
+#endif
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+ arch |= __AUDIT_ARCH_LE;
+#endif
+
+ return arch;
+}
+
asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
{
long long ret = 0;
@@ -238,7 +252,7 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
ret = -1LL;
if (unlikely(current->audit_context))
- audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1],
+ audit_syscall_entry(audit_arch(), regs->regs[1],
regs->regs[2], regs->regs[3],
regs->regs[4], regs->regs[5]);