Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1384143imu; Fri, 9 Nov 2018 15:55:09 -0800 (PST) X-Google-Smtp-Source: AJdET5c+3ZI/tEVyvSRVE5anvuggn5vvb0fuqeN/dqyb8OporUSU98ubBucorIiX7cfoidmc9nWj X-Received: by 2002:a62:6007:: with SMTP id u7-v6mr3376568pfb.186.1541807709482; Fri, 09 Nov 2018 15:55:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541807709; cv=none; d=google.com; s=arc-20160816; b=ultdFnGr+IqF7RKg+tnv1kGO7zEjKiDT5vbrYmRDrf/EK5zdoOCOLrAZzhRYtb78xr sPR7sPh5r3ENMzHA/4+1NuyXGdBSK/iW11xH4L85Mmfy1CD916unw6O3vtu5+f116enN gYmMuPphTjwkfeFYfgoo5m/3FOaQbakXqZhoZw92Rz4uin/5TG0P+A7mgDfyurQq9++W Aob2GfURGCd4mIyLCf+lTT18tZBFcG3rsfueYMDgzp/wjYJD3PFipw74ZGTNG5nYskOp +Sk0VstWhqTZ9ZzUWjXngceViAazeBiYKLkZxZNdgNK8fEAdHETDgkvi+gf4oK5SsYEA 0v3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date; bh=i+g5RXPtuwp22QrPJyLkalhS62U+S+bj5fkT33MUG5g=; b=zWkG9NuOC22aJ/hA/WWFybpED/GKKsJ5/rmfTFGQ8MvMb0QK2zejW7/pDDnvRudkeL 2+Pb8bKBvcwReZtj9171VRUKgTNELs8BSOFa0e+AK3BYnn0UcRLKSa2UpxUODGdQdjJR aWn2kcgX74BMDTZbh2VWPiNkXguA8iZmm2VMpE3yu8+9Vz9g4gmH6mN3Hq8HeIGqo1DC nlqL/CSV6RmUkRRney/9lbg4hQuA5Revyqy93Pic+17i4mUsF/QdltOzVtfMVVPl6uXb x8UsIozypefMZ4CshJqnLOcTyEagajrBGmNe8uAgEwyZjYAXjrYo9g/3b/z3ZHlszvLb ElrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3-v6si8841609plk.23.2018.11.09.15.54.53; Fri, 09 Nov 2018 15:55:09 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728839AbeKJJhX (ORCPT + 99 others); Sat, 10 Nov 2018 04:37:23 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:49856 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727322AbeKJJhX (ORCPT ); Sat, 10 Nov 2018 04:37:23 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id AAE0B72CBF9; Sat, 10 Nov 2018 02:54:26 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 9DB067CD1FF; Sat, 10 Nov 2018 02:54:26 +0300 (MSK) Date: Sat, 10 Nov 2018 02:54:26 +0300 From: "Dmitry V. Levin" To: Vineet Gupta , Andrew Lutomirski , Alexey Brodkin Cc: Elvira Khabirova , Paul Moore , Eric Paris , linux-snps-arc@lists.infradead.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH 06/13 v3] arc: define syscall_get_arch() Message-ID: <20181109235426.GD2710@altlinux.org> Mail-Followup-To: Vineet Gupta , Andrew Lutomirski , Alexey Brodkin , Elvira Khabirova , Paul Moore , Eric Paris , linux-snps-arc@lists.infradead.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org References: <20181109031605.GF21511@altlinux.org> <456a69c6e01a6ab5b1af6d459a249388f8b4c1f5.camel@synopsys.com> <215d66fd9a197b631973c9ff75943b4c1216b899.camel@synopsys.com> <20181109233342.GC2710@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syscall_get_arch() is required to be implemented on all architectures that use tracehook_report_syscall_entry() in order to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request. Signed-off-by: Dmitry V. Levin --- v3: replaced #ifdefs with IS_ENABLED, made LE as default, added BE suffixes variants v2: defined AUDIT_ARCH_ARCOMPACT, AUDIT_ARCH_ARCOMPACTLE, AUDIT_ARCH_ARCV2, and AUDIT_ARCH_ARCV2LE instead of AUDIT_ARCH_ARC, updated syscall_get_arch() implementation accordingly. arch/arc/include/asm/syscall.h | 10 ++++++++++ include/uapi/linux/audit.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 29de09804306..10b2e7523bc8 100644 --- a/arch/arc/include/asm/syscall.h +++ b/arch/arc/include/asm/syscall.h @@ -9,6 +9,7 @@ #ifndef _ASM_ARC_SYSCALL_H #define _ASM_ARC_SYSCALL_H 1 +#include #include #include #include @@ -68,4 +69,13 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, } } +static inline int syscall_get_arch(void) +{ + return IS_ENABLED(CONFIG_ISA_ARCOMPACT) + ? (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) + ? AUDIT_ARCH_ARCOMPACTBE : AUDIT_ARCH_ARCOMPACT) + : (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) + ? AUDIT_ARCH_ARCV2BE : AUDIT_ARCH_ARCV2); +} + #endif diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 818ae690ab79..bedf3bf54c3a 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -375,6 +375,10 @@ enum { #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_ARCOMPACT (EM_ARCOMPACT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_ARCOMPACTBE (EM_ARCOMPACT) +#define AUDIT_ARCH_ARCV2 (EM_ARCV2|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_ARCV2BE (EM_ARCV2) #define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARMEB (EM_ARM) #define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) -- ldv