From patchwork Mon Feb 3 06:56:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 3568211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ABCF79F2F5 for ; Mon, 3 Feb 2014 06:59:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4234201BA for ; Mon, 3 Feb 2014 06:59:27 +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 0BA37201B9 for ; Mon, 3 Feb 2014 06:59:27 +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 1WADTm-0007em-C5; Mon, 03 Feb 2014 06:58:03 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WADTN-0007Eb-Bz; Mon, 03 Feb 2014 06:57:37 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WADTJ-0007Aw-R8 for linux-arm-kernel@lists.infradead.org; Mon, 03 Feb 2014 06:57:34 +0000 Received: by mail-pd0-f169.google.com with SMTP id v10so6565714pde.0 for ; Sun, 02 Feb 2014 22:57:12 -0800 (PST) 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=hctLbw7P+QojnXJkGxnwxl5syNG6FOg6V2Pd+2r9+Dw=; b=f7GgkwP/j28pCVixqQZUYozgE8WI8IZniAvfcIlhBLUtSHXLKtT8nfU71kOB+AyGib l5ovoKSC2mihLYhgIbMoJ1vrGfvhLrHB8qk25LmVR3YdZDK3vQ0VTU3aJ/urt3Ws+qMe kCDTHqbkO7Ydd78f3hYrw+Z5KDgWl+MFSX8rPOaciqZPpzYDhdsrZ9KMpMKj0TQk4iAN tA4XBnzrGXx2MWmxzzwe2osaxw2iK8/uoF4UENkrJ00K283T4vk0k2Rmh6mux5u1v/W5 5gylwhVLIvJKplPwhX9v22xRpZhMi40MDEGcuFHODUO4GKKZWc2ZF3Z0gjSddYz1xh4b DblQ== X-Gm-Message-State: ALoCoQldpcHCx2Ai0D0SsYNbglE5XGLIrr6k+4lwVI2I2YU+fwRObm/IukAabMj2Pu4iO8OQtPcs X-Received: by 10.68.125.164 with SMTP id mr4mr35379193pbb.27.1391410632320; Sun, 02 Feb 2014 22:57:12 -0800 (PST) Received: from localhost.localdomain (KD182249091062.au-net.ne.jp. [182.249.91.62]) by mx.google.com with ESMTPSA id hb10sm52674868pbd.1.2014.02.02.22.57.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Feb 2014 22:57:10 -0800 (PST) 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 v3 2/3] arm64: Add audit support Date: Mon, 3 Feb 2014 15:56:29 +0900 Message-Id: <1391410590-4884-3-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391410590-4884-1-git-send-email-takahiro.akashi@linaro.org> References: <1389946399-4525-1-git-send-email-takahiro.akashi@linaro.org> <1391410590-4884-1-git-send-email-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140203_015733_972210_C6657EC0 X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, arndb@arndb.de, linux-kernel@vger.kernel.org, AKASHI Takahiro , 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.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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. Signed-off-by: AKASHI Takahiro --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/syscall.h | 15 +++++++++++++++ include/uapi/linux/audit.h | 1 + 3 files changed, 17 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 6d4dd22..3c21405 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -19,6 +19,7 @@ config ARM64 select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select HARDIRQS_SW_RESEND + select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_TRACEHOOK select HAVE_DEBUG_BUGVERBOSE select HAVE_DEBUG_KMEMLEAK diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 70ba9d4..6900183 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 static inline int syscall_get_nr(struct task_struct *task, @@ -104,4 +106,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 0a73cf3..cf27cae 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -327,6 +327,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)