Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Paul Moore <paul@paul-moore.com>,
	linux-kernel@vger.kernel.org, Eric Paris <eparis@redhat.com>,
	Elvira Khabirova <lineprinter@altlinux.org>,
	Andy Lutomirski <luto@kernel.org>,
	linux-audit@redhat.com, linux-riscv@lists.infradead.org
Subject: Re: [PATCH 12/13] riscv: define syscall_get_arch()
Date: Sat, 10 Nov 2018 00:31:28 +0300
Message-ID: <20181109213128.GA1907@altlinux.org> (raw)
Message-ID: <20181109213128.MQi4ufF1bc80BBiuD7R1-n2JgmXZMLf82CJ6Pixu5As@z> (raw)
In-Reply-To: <mhng-2fa4cce8-2365-4f36-a07e-5f9ad61cfb88@palmer-si-x1c4>

[-- Attachment #1.1: Type: text/plain, Size: 2602 bytes --]

On Fri, Nov 09, 2018 at 10:45:54AM -0800, Palmer Dabbelt wrote:
> On Thu, 08 Nov 2018 19:17:13 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.
> >
> > Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> > ---
> >  arch/riscv/include/asm/syscall.h | 6 ++++++
> >  include/uapi/linux/audit.h       | 1 +
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
> > index 8d25f8904c00..7e1e26ca7317 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 <uapi/linux/audit.h>
> >  #include <linux/sched.h>
> >  #include <linux/err.h>
> >
> > @@ -99,4 +100,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
> >  	memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
> >  }
> >
> > +static inline int syscall_get_arch(void)
> > +{
> > +	return AUDIT_ARCH_RISCV;
> > +}
> > +
> >  #endif	/* _ASM_RISCV_SYSCALL_H */
> > diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> > index c4c8b131af48..ad4105c602a1 100644
> > --- a/include/uapi/linux/audit.h
> > +++ b/include/uapi/linux/audit.h
> > @@ -405,6 +405,7 @@ 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_RISCV	(EM_RISCV|__AUDIT_ARCH_64BIT)
> >  #define AUDIT_ARCH_S390		(EM_S390)
> >  #define AUDIT_ARCH_S390X	(EM_S390|__AUDIT_ARCH_64BIT)
> >  #define AUDIT_ARCH_SH		(EM_SH)
> 
> I think this is incorrect: EM_RISCV has 32-bit and 64-bit variants, and if I 
> understand what's going on here this is marking all RISC-V targets as 64-bit.  
> Since this is a userspace header, I think the right thing to switch on is 
> __riscv_xlen, which will be defined to either 32 or 64 depending on the base 
> ISA.
> We're also little endian.

OK, it means we need to introduce two different AUDIT_ARCH_ constants
for RISC-V.  Do you have any preferences for their names,
e.g. AUDIT_ARCH_RISCV and AUDIT_ARCH_RISCV64, or
AUDIT_ARCH_RISCV and AUDIT_ARCH_RISCV32, or
AUDIT_ARCH_RISCV64 and AUDIT_ARCH_RISCV32,
or anything else?


-- 
ldv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply index

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20181107042751.3b519062@akathisia>
     [not found] ` <CALCETrV1v-DPRfDRwiH=xn29bxWxiHdZtAH1nw=dsmDtnT0YGQ@mail.gmail.com>
2018-11-09  3:13   ` [PATCH 00/13] Prepare for PTRACE_GET_SYSCALL_INFO ldv
2018-11-09  3:13     ` Dmitry V. Levin
2018-11-09  3:17     ` [PATCH 12/13] riscv: define syscall_get_arch() ldv
2018-11-09  3:17       ` Dmitry V. Levin
2018-11-09  6:59       ` david.abdurachmanov
2018-11-09  6:59         ` David Abdurachmanov
2018-11-09 22:28         ` ldv
2018-11-09 22:28           ` Dmitry V. Levin
2018-11-10  5:12           ` david.abdurachmanov
2018-11-10  5:12             ` David Abdurachmanov
2018-11-10  9:27           ` schwab
2018-11-10  9:27             ` Andreas Schwab
2018-11-09 18:45       ` palmer
2018-11-09 18:45         ` Palmer Dabbelt
2018-11-09 21:31         ` ldv [this message]
2018-11-09 21:31           ` Dmitry V. Levin
2018-11-09 22:48           ` [PATCH 12/13 v2] " ldv
2018-11-09 22:48             ` Dmitry V. Levin
2018-11-11 21:21             ` palmer
2018-11-11 21:21               ` Palmer Dabbelt
2018-11-09  6:06     ` [PATCH 00/13] Prepare for PTRACE_GET_SYSCALL_INFO luto
2018-11-09  6:06       ` Andy Lutomirski
2018-11-20  0:11   ` [PATCH v2 00/15] " ldv
2018-11-20  0:11     ` Dmitry V. Levin
2018-11-20  0:16     ` [PATCH v2 13/15] riscv: define syscall_get_arch() ldv
2018-11-20  0:16       ` Dmitry V. Levin
2018-11-20 20:26     ` [PATCH v2 00/15] Prepare for PTRACE_GET_SYSCALL_INFO paul
2018-11-20 20:26       ` Paul Moore
2018-11-21  0:44     ` [PATCH v2 16/15] syscall_get_arch: add "struct task_struct *" argument ldv
2018-11-21  0:44       ` Dmitry V. Levin
2018-11-21 15:15       ` luto
2018-11-21 15:15         ` Andy Lutomirski
2018-11-21 15:47       ` palmer
2018-11-21 15:47         ` Palmer Dabbelt
2018-11-21 18:40       ` paul.burton
2018-11-21 18:40         ` Paul Burton
2018-11-21 19:00         ` ldv
2018-11-21 19:00           ` Dmitry V. Levin
2018-11-21 19:35           ` [PATCH v2 16/15 v2] " ldv
2018-11-21 19:35             ` Dmitry V. Levin
2018-11-21 19:45             ` paul.burton
2018-11-21 19:45               ` Paul Burton
2018-11-27 10:34       ` [PATCH v2 16/15] " mpe
2018-11-27 10:34         ` Michael Ellerman

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109213128.GA1907@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=eparis@redhat.com \
    --cc=lineprinter@altlinux.org \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=luto@kernel.org \
    --cc=palmer@sifive.com \
    --cc=paul@paul-moore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org infradead-linux-riscv@archiver.kernel.org
	public-inbox-index linux-riscv


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/ public-inbox