BACKPORT: asm/syscall.h: add syscall_get_arch
authorWill Drewry <wad@chromium.org>
Fri, 17 Feb 2012 21:03:37 +0000 (15:03 -0600)
committerGrant Grundler <grundler@google.com>
Thu, 24 May 2012 22:16:45 +0000 (15:16 -0700)
Adds a stub for a function that will return the AUDIT_ARCH_* value
appropriate to the supplied task based on the system call convention.

For audit's use, the value can generally be hard-coded at the
audit-site.  However, for other functionality not inlined into syscall
entry/exit, this makes that information available.  seccomp_filter is
the first planned consumer and, as such, the comment indicates a tie to
CONFIG_HAVE_ARCH_SECCOMP_FILTER.

Acked-by: Eric Paris <eparis@redhat.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Suggested-by: Roland McGrath <mcgrathr@chromium.org>
Signed-off-by: Will Drewry <wad@chromium.org>
Change-Id: Ia6d20afa8610285513c22089d58613a54731c361
v18: comment and change reword and rebase.
v14: rebase/nochanges
v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc
v12: rebase on to linux-next
v11: fixed improper return type
v10: introduced

BUG=chromium-os:27878
TEST=none. Part of a much larger stack that really should merge together.

Change-Id: I64f9bf538e978e2225938d1df64c5baa3de38f81
Reviewed-on: https://gerrit.chromium.org/gerrit/21361
Reviewed-by: Will Drewry <wad@chromium.org>
Tested-by: Will Drewry <wad@chromium.org>
include/asm-generic/syscall.h

index 5c122ae..5b09392 100644 (file)
@@ -142,4 +142,18 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
                           unsigned int i, unsigned int n,
                           const unsigned long *args);
 
+/**
+ * syscall_get_arch - return the AUDIT_ARCH for the current system call
+ * @task:      task of interest, must be in system call entry tracing
+ * @regs:      task_pt_regs() of @task
+ *
+ * Returns the AUDIT_ARCH_* based on the system call convention in use.
+ *
+ * It's only valid to call this when @task is stopped on entry to a system
+ * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
+ *
+ * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
+ * provide an implementation of this.
+ */
+int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
 #endif /* _ASM_SYSCALL_H */