From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Drewry Subject: [PATCH v17 07/15] asm/syscall.h: add syscall_get_arch Date: Thu, 29 Mar 2012 15:01:52 -0500 Message-ID: <1333051320-30872-8-git-send-email-wad@chromium.org> References: <1333051320-30872-1-git-send-email-wad@chromium.org> Reply-To: kernel-hardening@lists.openwall.com Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: In-Reply-To: <1333051320-30872-1-git-send-email-wad@chromium.org> To: linux-kernel@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, kernel-hardening@lists.openwall.com, netdev@vger.kernel.org, x86@kernel.org, arnd@arndb.de, davem@davemloft.net, hpa@zytor.com, mingo@redhat.com, oleg@redhat.com, peterz@infradead.org, rdunlap@xenotime.net, mcgrathr@chromium.org, tglx@linutronix.de, luto@mit.edu, eparis@redhat.com, serge.hallyn@canonical.com, djm@mindrot.org, scarybeasts@gmail.com, indan@nul.nu, pmoore@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, eric.dumazet@gmail.com, markus@chromium.org, coreyb@linux.vnet.ibm.com, keescook@chromium.org, jmorris@namei.org, Will Drewry List-Id: linux-arch.vger.kernel.org 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 HAVE_ARCH_SECCOMP_FILTER. That is probably an unneeded detail. Acked-by: Serge Hallyn Suggested-by: Roland McGrath Signed-off-by: Will Drewry v14..v17: rebase/nochanges v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc v12: rebase on to linux-next v11: fixed improper return type v10: introduced --- include/asm-generic/syscall.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index 5c122ae..a2c13dc 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h @@ -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. + * + * Note, at present this function is only required with + * CONFIG_HAVE_ARCH_SECCOMP_FILTER. + */ +int syscall_get_arch(struct task_struct *task, struct pt_regs *regs); #endif /* _ASM_SYSCALL_H */ -- 1.7.5.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-gy0-f174.google.com ([209.85.160.174]:60000 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759885Ab2C2UCh (ORCPT ); Thu, 29 Mar 2012 16:02:37 -0400 Received: by ghrr11 with SMTP id r11so1824276ghr.19 for ; Thu, 29 Mar 2012 13:02:36 -0700 (PDT) From: Will Drewry Subject: [PATCH v17 07/15] asm/syscall.h: add syscall_get_arch Date: Thu, 29 Mar 2012 15:01:52 -0500 Message-ID: <1333051320-30872-8-git-send-email-wad@chromium.org> In-Reply-To: <1333051320-30872-1-git-send-email-wad@chromium.org> References: <1333051320-30872-1-git-send-email-wad@chromium.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-kernel@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, kernel-hardening@lists.openwall.com, netdev@vger.kernel.org, x86@kernel.org, arnd@arndb.de, davem@davemloft.net, hpa@zytor.com, mingo@redhat.com, oleg@redhat.com, peterz@infradead.org, rdunlap@xenotime.net, mcgrathr@chromium.org, tglx@linutronix.de, luto@mit.edu, eparis@redhat.com, serge.hallyn@canonical.com, djm@mindrot.org, scarybeasts@gmail.com, indan@nul.nu, pmoore@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, eric.dumazet@gmail.com, markus@chromium.org, coreyb@linux.vnet.ibm.com, keescook@chromium.org, jmorris@namei.org, Will Drewry Message-ID: <20120329200152.Jkw38KzMY1rkFEGoJT1tLU6VgPAiJfOSti7Imz9kqic@z> 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 HAVE_ARCH_SECCOMP_FILTER. That is probably an unneeded detail. Acked-by: Serge Hallyn Suggested-by: Roland McGrath Signed-off-by: Will Drewry v14..v17: rebase/nochanges v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc v12: rebase on to linux-next v11: fixed improper return type v10: introduced --- include/asm-generic/syscall.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index 5c122ae..a2c13dc 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h @@ -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. + * + * Note, at present this function is only required with + * CONFIG_HAVE_ARCH_SECCOMP_FILTER. + */ +int syscall_get_arch(struct task_struct *task, struct pt_regs *regs); #endif /* _ASM_SYSCALL_H */ -- 1.7.5.4