Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3367169imu; Sun, 11 Nov 2018 13:22:02 -0800 (PST) X-Google-Smtp-Source: AJdET5e6kcptY/+XbCV+TWKrb0edTR1TkgfRbt0biTftXFDG3BdEVPGef7T5z7UCwvm7hb6c2/30 X-Received: by 2002:a17:902:5a89:: with SMTP id r9-v6mr6283083pli.305.1541971322895; Sun, 11 Nov 2018 13:22:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541971322; cv=none; d=google.com; s=arc-20160816; b=JTCwJ7LpMgVaddeUjYl1opyPBDjUnAVlgtzj1Sgv9PyQrRbt01eEw6iDDtO0Oe2L9p qS/AQPv8I8nfnYD7howIqI07+p5qGONO1vqJr6z3fXxzMTmIZLi+iraZ48IymYRdgaS4 gJH0VMEqMMrijVFoztR/xzoVwGswIw+Cv1fVj0k59rdBeasJz9a59RKciL3bqPydC9K6 W1ZZmD9gV8/LXHaXQR1B2/hQ1aGmiHDZNK7tKcnVD45dz9eufTUXfvJ98fJZ++BpE8HP pO8JYIaOKWR2jo3gAZcTrzuRrzcJYhjey4nQNh3+Ck6PkTfbrM0sCDzsCs67iKYbAAr/ bJeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=4ACm6Uzc4H59VdfPYRJKhXWsdkoS01SqiW1/mSyC0ZA=; b=VgxNIfda2xYNZy9jIGfUUr4pZmUg4Re3pSYOTmOBJHD1mIgXnqpxyaxXQC6Sajx3r9 7H9qfe6gM1AWjp6sc2x4+1OCmYtSb8MMheb29h4y6QitHdAJOVdA31zrgTLnpaNPLvcD 6fQ4SW4XMajqmUVLSh3jBmWunaysqWSWa4jI+f6ARV0z9DFvLx69qNUwJ2gOxnhAdYvl oJJcEa1l0O/F54Gtuz0LcWxyNhpsCQAkyWWy0WKHKWv4F+kszKU0Sigj5v6ImO0jjcQX a0LU4nufaUpqEjpeBm4fdlFffoCTmCbeencJjWNaqVms/soyusaAB+NxQcKzXj3uPtdl whUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=P+NpAvTd; 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 t3-v6si16206940pfl.107.2018.11.11.13.21.46; Sun, 11 Nov 2018 13:22:02 -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; dkim=pass header.i=@sifive.com header.s=google header.b=P+NpAvTd; 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 S1727167AbeKLHLK (ORCPT + 99 others); Mon, 12 Nov 2018 02:11:10 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36695 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbeKLHLJ (ORCPT ); Mon, 12 Nov 2018 02:11:09 -0500 Received: by mail-pf1-f193.google.com with SMTP id d13-v6so3292611pfo.3 for ; Sun, 11 Nov 2018 13:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=4ACm6Uzc4H59VdfPYRJKhXWsdkoS01SqiW1/mSyC0ZA=; b=P+NpAvTd2nQNneNfHDrjIwgakcylAKJmk8qD2j+ayfZat2gx3ylCz9nB79OZIP0ejv 2dI1yAFke5FNjjGWsnd8Gn7t1dSVzT3swfv22Y3w0Aqk58JqvdQZ9wH+Z4DXamxtvMXh RY9BYEZutmyKW+fUgnk2z9oN21RwBeU0fTRaGNA/f1YWFPCz0QdRYZSggSJLY+Ca8jMY 1WCKBoBb+FijPu/AbZdrCHu216bji89oE/ugZdETvViwPJgbtMVAA/VVIFJD07jH9ZLe m8YFEBcAnqpdCsEUCUl3vSAceZIYbC6dqzA3psUzcIlQIPEIeyYHdA3TjFpbPVh5lCz/ 3xvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=4ACm6Uzc4H59VdfPYRJKhXWsdkoS01SqiW1/mSyC0ZA=; b=hsKeqrwKy9PxxHyi4o63d71u6dPXe1YpqruZtEHT2zarXJcQLTAiHScG7qSZzKVS4t OIQuuRTATYOtnhk+4av+ni3pEeeQonaHDQlB0Zyir7eEhHl5ZX1RxJJCFmH3RHSL92cb N1NmBzbF1AZjEsyuC1x1augIZcv+OsU6g4M/lETXgnIQpIF45fCWHqfFtln144ay61qN payCITD3sGAw8FF1YXKAp/NuP/tXUP9ZQ9D1pVAN3/3PRt3xTZmVLdfHCCimyuwhfRHS asqrliXBk4AI/MaGgb4mfvM3c52W7Qe6ozKnIYQVVzL8cJ6sDgk/hGz/vyIMxUO144SG v/hQ== X-Gm-Message-State: AGRZ1gJEUU/3f+JProxsxX3dbnkhP5BkdsJY2LjMCUpDMU+P8L4vmZtm ytDoPOp78Aixi2iU7JZVtXt5gw== X-Received: by 2002:a62:85:: with SMTP id 127-v6mr17404886pfa.24.1541971285447; Sun, 11 Nov 2018 13:21:25 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id j187-v6sm15853836pfc.43.2018.11.11.13.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Nov 2018 13:21:24 -0800 (PST) Date: Sun, 11 Nov 2018 13:21:24 -0800 (PST) X-Google-Original-Date: Sun, 11 Nov 2018 13:20:33 PST (-0800) Subject: Re: [PATCH 12/13 v2] riscv: define syscall_get_arch() In-Reply-To: <20181109224833.GA2710@altlinux.org> CC: luto@kernel.org, lineprinter@altlinux.org, david.abdurachmanov@gmail.com, aou@eecs.berkeley.edu, paul@paul-moore.com, eparis@redhat.com, linux-riscv@lists.infradead.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: ldv@altlinux.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 09 Nov 2018 14:48:33 PST (-0800), ldv@altlinux.org wrote: > 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. > > Based-on-patch-by: David Abdurachmanov > Signed-off-by: Dmitry V. Levin > --- > 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 c4c8b131af48..1b199a77a6b9 100644 > --- a/include/uapi/linux/audit.h > +++ b/include/uapi/linux/audit.h > @@ -405,6 +405,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) Reviewed-by: Palmer Dabbelt Thanks!