From patchwork Sat Mar 15 05:49:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 3836561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5349EBF540 for ; Sat, 15 Mar 2014 06:35:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51A482035C for ; Sat, 15 Mar 2014 06:35:00 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A2942014A for ; Sat, 15 Mar 2014 06:34:59 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhUO-00054G-Rg; Sat, 15 Mar 2014 05:50:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhTu-0008QD-57; Sat, 15 Mar 2014 05:50:02 +0000 Received: from mail-pb0-f48.google.com ([209.85.160.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhTl-0008Nz-PR for linux-arm-kernel@lists.infradead.org; Sat, 15 Mar 2014 05:49:55 +0000 Received: by mail-pb0-f48.google.com with SMTP id md12so3513441pbc.35 for ; Fri, 14 Mar 2014 22:49:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1HOfF9NIvYqWKS4mS52cCeMNv+zr9rc7Sw/8kD8P0Tg=; b=WKnjYj7qa2Z9q4txGeRqL4fU7VEdAXF4cT2UjauAzoCc1bQDfs9shnscj4RrNFZ+0g unLFYhfwsp4eBZja9ZeiUlJvNApSDz3P7CybTXQgfqRpuslBX/ZoMG0mP+y8jTnTIAT/ UHEuLOo6tavMRVu33R9f0kUuShCEci3hEtF1cToXZ/5UPvEuY8t+YmxoviucS55bnNTv uw0Ze+fXUqzGR3COsL5CZPZ4jUXWJr+qOFc0K0ChyWNKF97T+I7ERYsB0LBVQdlNDm7V ZDUBtoOCGkXxxFsfRVJL4nwSRvEChQM7BdKlpHdljMMFoanzoO0HbBd0exisDlmF5VX0 Bw2A== X-Gm-Message-State: ALoCoQlCi5eylVmBq7pjfLzkeBr5S+abxBkLY/7xOTPCBn8rF+I8S2NomUSaMrikl0Yil+hLMVv6 X-Received: by 10.66.149.231 with SMTP id ud7mr13533486pab.8.1394862572506; Fri, 14 Mar 2014 22:49:32 -0700 (PDT) Received: from localhost.localdomain (pdddd29.tkyoac00.ap.so-net.ne.jp. [218.221.221.41]) by mx.google.com with ESMTPSA id el14sm36061873pac.31.2014.03.14.22.49.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:49:31 -0700 (PDT) From: AKASHI Takahiro To: viro@zeniv.linux.org.uk, eparis@redhat.com, rgb@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH_v8 1/2] arm64: Add audit support Date: Sat, 15 Mar 2014 14:49:07 +0900 Message-Id: <1394862548-29060-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394862548-29060-1-git-send-email-takahiro.akashi@linaro.org> References: <1394705767-12423-1-git-send-email-takahiro.akashi@linaro.org> <1394862548-29060-1-git-send-email-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140315_014953_944588_CB419EB6 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, AKASHI Takahiro , arndb@arndb.de, linux-kernel@vger.kernel.org, dsaxena@linaro.org, linux-audit@redhat.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On AArch64, audit is supported through generic lib/audit.c and compat_audit.c, and so this patch adds arch specific definitions required. Acked-by Will Deacon Acked-by: Richard Guy Briggs Signed-off-by: AKASHI Takahiro --- arch/arm64/Kconfig | 2 ++ arch/arm64/include/asm/syscall.h | 15 +++++++++++++++ include/uapi/linux/audit.h | 1 + 3 files changed, 18 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b1dcdb4..7c1f8c7 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -9,6 +9,7 @@ config ARM64 select ARM_AMBA select ARM_ARCH_TIMER select ARM_GIC + select AUDIT_ARCH_COMPAT_GENERIC select BUILDTIME_EXTABLE_SORT select CLONE_BACKWARDS select COMMON_CLK @@ -25,6 +26,7 @@ config ARM64 select GENERIC_STRNLEN_USER select GENERIC_TIME_VSYSCALL select HARDIRQS_SW_RESEND + select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_TRACEHOOK select HAVE_C_RECORDMCOUNT diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 383771e..ce3882f 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -16,7 +16,9 @@ #ifndef __ASM_SYSCALL_H #define __ASM_SYSCALL_H +#include #include +#include extern const void *sys_call_table[]; @@ -105,4 +107,17 @@ static inline void syscall_set_arguments(struct task_struct *task, memcpy(®s->regs[i], args, n * sizeof(args[0])); } +/* + * We don't care about endianness (__AUDIT_ARCH_LE bit) here because + * AArch64 has the same system calls both on little- and big- endian. + */ +static inline int syscall_get_arch(struct task_struct *task, + struct pt_regs *regs) +{ + if (is_compat_thread(task_thread_info(task))) + return AUDIT_ARCH_ARM; + + return AUDIT_ARCH_AARCH64; +} + #endif /* __ASM_SYSCALL_H */ diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 624df43..aa86fab 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -333,6 +333,7 @@ enum { /* distinguish syscall tables */ #define __AUDIT_ARCH_64BIT 0x80000000 #define __AUDIT_ARCH_LE 0x40000000 +#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARMEB (EM_ARM)