From patchwork Fri Nov 9 23:54:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dmitry V. Levin" X-Patchwork-Id: 995799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fXanL7PH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ZBPrXW0e"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42sH7l4V6Wz9s3C for ; Sat, 10 Nov 2018 10:54:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nxbduTh1ZJ6V1WpGExcwIwOj/6/0gDGh9pv3IFU63NM=; b=fXanL7PHYByvNp hTzeVFLb4I98hYg8aBpC+IPIhCQr+sNjp62SPQoP+NmZdG0hWCuP0XYbZvb88sSy9PUFlAEnHgM23 hNpPawuQPXfNugEMk/ZIIYfRCLDVVSBbO488hM8ue6nRfmLMdydOSFt+mQ9npUU3lfZjAZQdyy9sT rovCuVlyPnkSrydoiZ8DbbwfO8rutfY3YgKYtlGW9RSnuVftwFcpvHvuM83pWoYboj4oYD4NxZT65 Vl4mlN1BdFtmrULjEeZR6MrJZCSp/LRD2jOsT6bkZppl2YEOpjHBc4d8tDfAJsxf2HVgLPCP4S06h 3I9FtGequrlav8mBHUkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGbp-0007BJ-OP; Fri, 09 Nov 2018 23:54:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGbo-0007BC-Ji for linux-snps-arc@bombadil.infradead.org; Fri, 09 Nov 2018 23:54:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=i+g5RXPtuwp22QrPJyLkalhS62U+S+bj5fkT33MUG5g=; b=ZBPrXW0eRKDFbPdPnr7zbRmz+ oRPwpO7uVj3pt5+96uCdfPUtNAIh2Nd+PIvjO8PuQ/oDk6NP63SJXIF4I3yc8aHo56fK4VxMfkc1B uXxrFrJo5ujOxpyZxwahYsisnsPu1J/Xs+q/ZbLSnS7RkQMvXjypcwFtz/mo1eK8rQBHNJANR3DQ7 JUdGKRW9MXQ+5hOtRxDoZhTHcEx/RoaP4U1llcKQ7HND5JWwJw4WBmtKLaJGRtfmKkRjBSwivta+A bSpjg9Et4jBBnWJERYK2vL2KAprY7DNqZqHQF8vNck9IIUnq05BO5PrL76kvFAN6MgGbl8JjLLLTa 8y6H7L6zA==; Received: from vmicros1.altlinux.org ([194.107.17.57]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGbl-000245-K2 for linux-snps-arc@lists.infradead.org; Fri, 09 Nov 2018 23:54:39 +0000 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 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181109_235437_771880_290BA7CB X-CRM114-Status: UNSURE ( 8.35 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Moore , linux-kernel@vger.kernel.org, Eric Paris , Elvira Khabirova , linux-audit@redhat.com, linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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 Acked-by: Vineet Gupta --- 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)