From patchwork Fri Nov 9 23:33:23 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: 995786 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="ZI4BtDF1"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="qZGI8WYM"; 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 42sGgV0YClz9s9G for ; Sat, 10 Nov 2018 10:33:42 +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=wDx8brKilKWpw7j0/xLIWt5GKbOYNKNSK3te29N4fCQ=; b=ZI4BtDF1bsrYEO yHEvIBwm0XqkM348ZWvtmifYFh355+gpKUw4o9XcxufxoG8RtLEWcbekbpdLDgI+YygYbILkQf+JR htfy1z4STFbj4F1f2d5gSnam+I2kBKYLcS4zZs35nt8DnffGeijLEVv6QP2RKnOEDqjmzDy7Muyas 6w731bkb+MjyQjdF0EFeAvHuC5Vo5m3h4SUZ5z/n3AbunuVfhc8s5JH5UIg7nPBhMbLyj5rycQAwo bGWiM0Z6NndY0nlS2Z6eXqF45w0HTaui/FLb+0896rl4iww6YmtxzMvF0loNTX6Yt2u39D82/v7uF 1tpwBu4adRa4dlOXmkvA==; 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 1gLGHT-0007U9-KC; Fri, 09 Nov 2018 23:33:39 +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 1gLGHR-0007Th-Cy for linux-snps-arc@bombadil.infradead.org; Fri, 09 Nov 2018 23:33:37 +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=gZuWOaje+z1BF83ZyP6UnDzvU33ZLpv0Zw8mOXzVF8w=; b=qZGI8WYMK5ODsLKvpmptIce92 fElKUyESa9c2y2pQdyUcbvD8rABbDFdVgNz0X2q2giJzscSV3Ro3CNAMlKrCp+xPJClgqAmsy9Wf5 pk+3fnoPif/ZEDf8w6AubV2dW3ibS+HgCZxXvBw6p6gofifY/plGCBU8JbJbu5V9IgQQYwqMevt6Q jwi2fA3lPdtkB5RmeIWom4g15WttM6LBqW4DUa8RFJBIgCOte61vtsKtSpZSwosFp7yRK+6EpSeBP uS27VEXxwg12+aGM2QYIxGMR99l0iYjoU0MU64AzV1XeUJH38Tef59+NHZLVmOrd+GN1ShfkOcnc3 yRDXaVuJg==; Received: from vmicros1.altlinux.org ([194.107.17.57]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGHO-0001Mp-BM for linux-snps-arc@lists.infradead.org; Fri, 09 Nov 2018 23:33:35 +0000 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 9FE4872CBF9; Sat, 10 Nov 2018 02:33:23 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 9224B7CD1FF; Sat, 10 Nov 2018 02:33:23 +0300 (MSK) Date: Sat, 10 Nov 2018 02:33:23 +0300 From: "Dmitry V. Levin" To: Vineet Gupta , Andy Lutomirski Subject: [PATCH 02/13 v2] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h Message-ID: <20181109233323.GB2710@altlinux.org> Mail-Followup-To: Vineet Gupta , Andy Lutomirski , Elvira Khabirova , Alexey Brodkin , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org References: <20181109031536.GB21511@altlinux.org> <20181109214422.GB1907@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181109214422.GB1907@altlinux.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181109_233334_470743_88AE36B9 X-CRM114-Status: GOOD ( 10.46 ) 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: linux-snps-arc@lists.infradead.org, Elvira Khabirova , Alexey Brodkin , linux-kernel@vger.kernel.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org These should never have been defined in the arch tree to begin with, and now uapi/linux/audit.h header is going to use EM_ARCOMPACT and EM_ARCV2 in order to define AUDIT_ARCH_ARCOMPACT and AUDIT_ARCH_ARCV2 which are needed to implement syscall_get_arch() which in turn is required to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request. Signed-off-by: Dmitry V. Levin Acked-by: Vineet Gupta --- v2: do not add EM_ARC, move EM_ARCOMPACT and EM_ARCV2 instead. arch/arc/include/asm/elf.h | 6 +----- include/uapi/linux/elf-em.h | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h index aa2d6da9d187..2b80c184c9c8 100644 --- a/arch/arc/include/asm/elf.h +++ b/arch/arc/include/asm/elf.h @@ -10,13 +10,9 @@ #define __ASM_ARC_ELF_H #include +#include #include -/* These ELF defines belong to uapi but libc elf.h already defines them */ -#define EM_ARCOMPACT 93 - -#define EM_ARCV2 195 /* ARCv2 Cores */ - #define EM_ARC_INUSE (IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \ EM_ARCOMPACT : EM_ARCV2) diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h index ba3696e3d694..91b33833630b 100644 --- a/include/uapi/linux/elf-em.h +++ b/include/uapi/linux/elf-em.h @@ -34,6 +34,7 @@ #define EM_M32R 88 /* Renesas M32R */ #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARCOMPACT 93 /* ARCompact processor */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ #define EM_TI_C6000 140 /* TI C6X DSPs */ @@ -42,6 +43,7 @@ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ #define EM_TILEGX 191 /* Tilera TILE-Gx */ +#define EM_ARCV2 195 /* ARCv2 Cores */ #define EM_RISCV 243 /* RISC-V */ #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ From patchwork Fri Nov 9 23:33:42 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: 995787 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="p/swwCyR"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="gBd7icLH"; 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 42sGgq0cYJz9sDT for ; Sat, 10 Nov 2018 10:33:59 +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=XBXHjzYUcGj63S8UnGZZdaq0z2bRKjAMnU0povofeMc=; b=p/swwCyRt7VfYt 2KO5f9TIVcma2PZmXgFp12J30z0rwuA0SjnOp0olcAKL3XEBAKu8Gl/yOwRQkptrGqsAiBJSd/r+N QwxMOFBJf9pedxUpCZPnxkXWbLJhgjczfzNVFpAgOBXKOsmjsWDohGuNyU+krmTtBAQQc6FcviIum VR5e3jZTI/LFiUq+oeZmcZHhIi/rN2dbpFQxzz56dQ41QmtWvL86eR6kFbX9rt863j2KazjbXHou8 hZTnmSIwa7hcYdLPBONusxcRkXgt6kEj9hYF1njxNI7/+kX3lzoLGfoKkPbGTRrAWNQEZOsN79tA3 gpAH5lw4JFBnZoddjCqA==; 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 1gLGHl-0007VK-4r; Fri, 09 Nov 2018 23:33:57 +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 1gLGHk-0007V9-4U for linux-snps-arc@bombadil.infradead.org; Fri, 09 Nov 2018 23:33:56 +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=lbTzFz/q02vPpBVUrdw6VO14dGpw4pkR2106r8UEHVI=; b=gBd7icLH/CgopYsIKgkPXgmpe 6hUzv8rb5B1oj6ANhqjmLfk2RSC+x8dmXFEjmw9Mmble1OuPaPPe/bAwCcWf76QVuPfW2JeSpTGyb JGdt1PppHbtWvVrFkiNnaKR8aS+a/Z2Kgae1nUycNCsJ3udsrHIcSdeV81Fiur319UXTOxjbyZRt1 FTqz704+6mVwQIeuk8klabz4640uSG6SQ5cx/z2VW27adGzjVJiUFoI8KHmzK11OakaO7pMbvRdjb r/1Cot+1IPi/0vAPA23qIU2+LOujtIwADsZdimIIV9QS6zULDjpladok8RI24M7iI4UICGefoxamV aW56gRoZw==; Received: from vmicros1.altlinux.org ([194.107.17.57]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGHh-0001Nt-9Y for linux-snps-arc@lists.infradead.org; Fri, 09 Nov 2018 23:33:54 +0000 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id C459372CBF9; Sat, 10 Nov 2018 02:33:42 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id B92E87CD1FF; Sat, 10 Nov 2018 02:33:42 +0300 (MSK) Date: Sat, 10 Nov 2018 02:33:42 +0300 From: "Dmitry V. Levin" To: Andrew Lutomirski , Alexey Brodkin , Vineet Gupta Subject: [PATCH 06/13 v2] arc: define syscall_get_arch() Message-ID: <20181109233342.GC2710@altlinux.org> Mail-Followup-To: Andrew Lutomirski , Alexey Brodkin , Vineet Gupta , 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> 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_233353_425261_5484DA41 X-CRM114-Status: UNSURE ( 8.33 ) 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 --- v2: define AUDIT_ARCH_ARCOMPACT, AUDIT_ARCH_ARCOMPACTLE, AUDIT_ARCH_ARCV2, and AUDIT_ARCH_ARCV2LE instead of AUDIT_ARCH_ARC, update syscall_get_arch() implementation accordingly. arch/arc/include/asm/syscall.h | 18 ++++++++++++++++++ include/uapi/linux/audit.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 29de09804306..a1b698290778 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,21 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, } } +static inline int syscall_get_arch(void) +{ +#ifdef CONFIG_ISA_ARCOMPACT +# ifdef CONFIG_CPU_BIG_ENDIAN + return AUDIT_ARCH_ARCOMPACT; +# else + return AUDIT_ARCH_ARCOMPACTLE; +# endif +#else /* CONFIG_ISA_ARCV2 */ +# ifdef CONFIG_CPU_BIG_ENDIAN + return AUDIT_ARCH_ARCV2; +# else + return AUDIT_ARCH_ARCV2LE; +# endif +#endif +} + #endif diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 818ae690ab79..8e70fb70b8f8 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) +#define AUDIT_ARCH_ARCOMPACTLE (EM_ARCOMPACT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_ARCV2 (EM_ARCV2) +#define AUDIT_ARCH_ARCV2LE (EM_ARCV2|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARMEB (EM_ARM) #define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)