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: 26328 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54312202DD for ; Sat, 15 Mar 2014 05:51:20 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf12990515obc.1 for ; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Sm+LkifBWGbrX9xQLg6YVoxIlxpx8MGiAglHARbbchY=; b=nCpRByMEo/H4HNHWtBxBmnY2/LDiaZ3EMu4yhBAGCAjvPvvpiNAQ9MkizVWEQo7GHW gGTSQYMbFJnUMERFDR/xvZqj+LmasKqgkDLAdAdYHWypUSDaHlUM26aMUw2thBvSW3lz P5MwDKQV7lAYqYalYKmgj8VSYYqgOqZZC2di6L6fAtaTxakBbpe8yUgG/TsjPropKjtU uq7ByZK0rS7FRG0/Hwx70TZIeYkI1n9UlOGgq48EORexFPKIOz56nntkv4eK136dtNUj DBRucIM2LY3b9PvnExcqOfl22/V7hcEqgmq4G8iif7A0hE28ybBTq1YQqYBGTxDQOteb S+kQ== X-Gm-Message-State: ALoCoQkkpCMYB6Cnu2x8sAnQgfpofbKCJZIA75gzpOkaTgRckwtpu3R0AkRVCEGPLcRWOcQqlBCx X-Received: by 10.43.125.196 with SMTP id gt4mr4450097icc.32.1394862679859; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.37 with SMTP id j34ls731461qga.73.gmail; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr9560878vec.15.1394862679785; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id dd4si2920010vcb.145.2014.03.14.22.51.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:51:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id id10so3652595vcb.40 for ; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) X-Received: by 10.52.247.231 with SMTP id yh7mr44273vdc.34.1394862679697; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp73306vck; Fri, 14 Mar 2014 22:51:19 -0700 (PDT) X-Received: by 10.66.141.165 with SMTP id rp5mr13258938pab.90.1394862677043; Fri, 14 Mar 2014 22:51:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xj10si4417398pab.327.2014.03.14.22.50.47; Fri, 14 Mar 2014 22:50:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756518AbaCOFtf (ORCPT + 26 others); Sat, 15 Mar 2014 01:49:35 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34153 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755906AbaCOFtd (ORCPT ); Sat, 15 Mar 2014 01:49:33 -0400 Received: by mail-pa0-f41.google.com with SMTP id fa1so3546070pad.28 for ; Fri, 14 Mar 2014 22:49:32 -0700 (PDT) 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 Cc: dsaxena@linaro.org, arndb@arndb.de, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-audit@redhat.com, AKASHI Takahiro 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)