aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorWill Drewry <wad@chromium.org>2012-01-18 15:00:56 -0600
committerJohn Rigby <john.rigby@linaro.org>2012-06-25 12:17:10 -0600
commit21792c198ee91989b4f59ae579f8fe17cad760c7 (patch)
tree6e92716aa8819aebb16bdbcc9befb987bf8119be /arch
parent3572f8f99171df6d883c11e192dad7a957de6b67 (diff)
UBUNTU: SAUCE: SECCOMP: arch/x86: add syscall_get_arch to syscall.h
Add syscall_get_arch() to export the current AUDIT_ARCH_* based on system call entry path. v14: rebase/nochanges v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Will Drewry <wad@chromium.org> Signed-off-by: Kees Cook <kees@ubuntu.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/syscall.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 386b78686c4..8ec41f1454e 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -13,6 +13,7 @@
#ifndef _ASM_X86_SYSCALL_H
#define _ASM_X86_SYSCALL_H
+#include <linux/audit.h>
#include <linux/sched.h>
#include <linux/err.h>
#include <asm/asm-offsets.h> /* For NR_syscalls */
@@ -88,6 +89,12 @@ static inline void syscall_set_arguments(struct task_struct *task,
memcpy(&regs->bx + i, args, n * sizeof(args[0]));
}
+static inline int syscall_get_arch(struct task_struct *task,
+ struct pt_regs *regs)
+{
+ return AUDIT_ARCH_I386;
+}
+
#else /* CONFIG_X86_64 */
static inline void syscall_get_arguments(struct task_struct *task,
@@ -212,6 +219,22 @@ static inline void syscall_set_arguments(struct task_struct *task,
}
}
+static inline int syscall_get_arch(struct task_struct *task,
+ struct pt_regs *regs)
+{
+#ifdef CONFIG_IA32_EMULATION
+ /*
+ * TS_COMPAT is set for 32-bit syscall entries and then
+ * remains set until we return to user mode.
+ *
+ * TIF_IA32 tasks should always have TS_COMPAT set at
+ * system call time.
+ */
+ if (task_thread_info(task)->status & TS_COMPAT)
+ return AUDIT_ARCH_I386;
+#endif
+ return AUDIT_ARCH_X86_64;
+}
#endif /* CONFIG_X86_32 */
#endif /* _ASM_X86_SYSCALL_H */