Commit 07bd18d00d5dcf84eb22f8120f47f09c3d8fe27d

Authored by Will Drewry
Committed by James Morris
1 parent 932ecebb04

asm/syscall.h: add syscall_get_arch

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.

Suggested-by: Roland McGrath <mcgrathr@chromium.org>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Eric Paris <eparis@redhat.com>

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
Signed-off-by: James Morris <james.l.morris@oracle.com>

Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff

include/asm-generic/syscall.h
... ... @@ -142,5 +142,19 @@
142 142 unsigned int i, unsigned int n,
143 143 const unsigned long *args);
144 144  
  145 +/**
  146 + * syscall_get_arch - return the AUDIT_ARCH for the current system call
  147 + * @task: task of interest, must be in system call entry tracing
  148 + * @regs: task_pt_regs() of @task
  149 + *
  150 + * Returns the AUDIT_ARCH_* based on the system call convention in use.
  151 + *
  152 + * It's only valid to call this when @task is stopped on entry to a system
  153 + * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
  154 + *
  155 + * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
  156 + * provide an implementation of this.
  157 + */
  158 +int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
145 159 #endif /* _ASM_SYSCALL_H */