Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp14080imu; Mon, 19 Nov 2018 16:50:48 -0800 (PST) X-Google-Smtp-Source: AJdET5eEHtir+lNXVJPJnq+KTRmwO1nT6gcg+aQuCCjRN8Mw5fvM1KVcln5HGdLAAzUIrH0kd6z2 X-Received: by 2002:a17:902:6a3:: with SMTP id 32-v6mr25297761plh.337.1542675048408; Mon, 19 Nov 2018 16:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542675048; cv=none; d=google.com; s=arc-20160816; b=hYqMB/JudOm2bKCORiqAQhnXH3k6ssK+v+RSojQuSkKWG/fD+IHyJMrPJyp47H4Upf 9MNZhrBLQccpHsDg3o+0BHJ4KXTm/3Kr7xdvgVqet1dHRhQ6Zx4VWKKiy6bspcGQIHxu oO5mVwq3DNR6TLwwYtyFz8wjTDHyWQXPBa9EFhmRG7B+VIip4c3/BsYocG4TFP8+SGbN h4BhC9XweNsFVaZOuYEp39DvJ9JvYPCb7E3a18iLmTRWlj16fn2n/TcX4nOZwApAvRC4 5YK7s2beNYCEw2mhQ37zimLm+VKJfjjO0vtS9bC983gP/XVQc+wb1X7ZCpukDHYVOsl9 I1bw== 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:message-id:subject:cc:to:from:date; bh=ehTRxzukPmODtpRsfdRxOlXwC3M/fCALbPJAOOE6THY=; b=uP7XPCj+uFQ2sCIDOnRZtMdoF0OZd0IrpkC4aTRBO/TgT6TbblS+hGT5u1E/k5Px96 MGmEiTTwQaCZqnAQ1Q4JN5GAfDszJGJnBiWYPIA6yr2IEu3DFLtk2suUAocea0kX+ZQt 7l40zJb+VVhSLcY1SQDjVcCFZulVS6jdsGqw5lykURxtUvedt1YFkiE8lAffwX4HAmXD dSKNOR1mmBKquSNFiabT2S5eY0S9tfpLmFEqSK4jzSdIPnTBsKqQxv8IiMJWW8KFkp4v OLBGhXKCNt1hTx7r14CylWrnv+1IVgrvheZURdDM6q0Jbry3A5XoZPkJvQVDmcnhNvfj OzFA== 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 16-v6si44750008pfy.64.2018.11.19.16.50.34; Mon, 19 Nov 2018 16:50:48 -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 S1732195AbeKTKm6 (ORCPT + 99 others); Tue, 20 Nov 2018 05:42:58 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:55976 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728979AbeKTKm6 (ORCPT ); Tue, 20 Nov 2018 05:42:58 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 6D2E172CA65; Tue, 20 Nov 2018 03:16:41 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 359517CD1FF; Tue, 20 Nov 2018 03:16:40 +0300 (MSK) Date: Tue, 20 Nov 2018 03:16:40 +0300 From: "Dmitry V. Levin" To: Andy Lutomirski , Palmer Dabbelt Cc: Elvira Khabirova , David Abdurachmanov , Albert Ou , Paul Moore , Eric Paris , linux-riscv@lists.infradead.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 13/15] riscv: define syscall_get_arch() Message-ID: <20181120001640.GM11387@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181120001128.GA11300@altlinux.org> 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 in order to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request. Based-on-patch-by: David Abdurachmanov Signed-off-by: Dmitry V. Levin Reviewed-by: Palmer Dabbelt --- v2: added Reviewed-by to [PATCH 12/13 v2] arch/riscv/include/asm/syscall.h | 10 ++++++++++ include/uapi/linux/audit.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h index 8d25f8904c00..bba3da6ef157 100644 --- a/arch/riscv/include/asm/syscall.h +++ b/arch/riscv/include/asm/syscall.h @@ -18,6 +18,7 @@ #ifndef _ASM_RISCV_SYSCALL_H #define _ASM_RISCV_SYSCALL_H +#include #include #include @@ -99,4 +100,13 @@ static inline void syscall_set_arguments(struct task_struct *task, memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0)); } +static inline int syscall_get_arch(void) +{ +#ifdef CONFIG_64BIT + return AUDIT_ARCH_RISCV64; +#else + return AUDIT_ARCH_RISCV32; +#endif +} + #endif /* _ASM_RISCV_SYSCALL_H */ diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 205aa32d81ed..a97a29922de0 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -410,6 +410,8 @@ enum { /* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_RISCV32 (EM_RISCV|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_S390 (EM_S390) #define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SH (EM_SH) -- ldv