From: palmer@sifive.com (Palmer Dabbelt)
To: linux-riscv@lists.infradead.org
Subject: [PATCH 12/13 v2] riscv: define syscall_get_arch()
Date: Sun, 11 Nov 2018 13:21:24 -0800 (PST) [thread overview]
Message-ID: <mhng-11f5dbf6-0aee-4f6e-b184-63536ecc3ac5@palmer-si-x1c4> (raw)
In-Reply-To: <20181109224833.GA2710@altlinux.org>
On Fri, 09 Nov 2018 14:48:33 PST (-0800), ldv at 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 <david.abdurachmanov@gmail.com>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
> 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 <uapi/linux/audit.h>
> #include <linux/sched.h>
> #include <linux/err.h>
>
> @@ -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 <palmer@sifive.com>
Thanks!
WARNING: multiple messages have this Message-ID (diff)
From: Palmer Dabbelt <palmer@sifive.com>
To: ldv@altlinux.org
Cc: aou@eecs.berkeley.edu, paul@paul-moore.com,
david.abdurachmanov@gmail.com, linux-kernel@vger.kernel.org,
eparis@redhat.com, lineprinter@altlinux.org, luto@kernel.org,
linux-audit@redhat.com, linux-riscv@lists.infradead.org
Subject: Re: [PATCH 12/13 v2] riscv: define syscall_get_arch()
Date: Sun, 11 Nov 2018 13:21:24 -0800 (PST) [thread overview]
Message-ID: <mhng-11f5dbf6-0aee-4f6e-b184-63536ecc3ac5@palmer-si-x1c4> (raw)
Message-ID: <20181111212124.FrxoZFRyzfmOCq1UWO5VVKJE7EdeMSWaw0IEPfRSPjw@z> (raw)
In-Reply-To: <20181109224833.GA2710@altlinux.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 <david.abdurachmanov@gmail.com>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
> 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 <uapi/linux/audit.h>
> #include <linux/sched.h>
> #include <linux/err.h>
>
> @@ -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 <palmer@sifive.com>
Thanks!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2018-11-11 21:21 UTC|newest]
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 Dmitry V. Levin
2018-11-09 3:13 ` Dmitry V. Levin
2018-11-09 3:17 ` [PATCH 12/13] riscv: define syscall_get_arch() Dmitry V. Levin
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 ` Dmitry V. Levin
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 ` Andreas Schwab
2018-11-10 9:27 ` Andreas Schwab
2018-11-09 18:45 ` Palmer Dabbelt
2018-11-09 18:45 ` Palmer Dabbelt
2018-11-09 21:31 ` Dmitry V. Levin
2018-11-09 21:31 ` Dmitry V. Levin
2018-11-09 22:48 ` [PATCH 12/13 v2] " Dmitry V. Levin
2018-11-09 22:48 ` Dmitry V. Levin
2018-11-11 21:21 ` Palmer Dabbelt [this message]
2018-11-11 21:21 ` Palmer Dabbelt
2018-11-09 6:06 ` [PATCH 00/13] Prepare for PTRACE_GET_SYSCALL_INFO Andy Lutomirski
2018-11-09 6:06 ` Andy Lutomirski
2018-11-20 0:11 ` [PATCH v2 00/15] " Dmitry V. Levin
2018-11-20 0:11 ` Dmitry V. Levin
2018-11-20 0:16 ` [PATCH v2 13/15] riscv: define syscall_get_arch() Dmitry V. Levin
2018-11-20 0:16 ` Dmitry V. Levin
2018-11-20 20:26 ` [PATCH v2 00/15] Prepare for PTRACE_GET_SYSCALL_INFO Paul Moore
2018-11-20 20:26 ` Paul Moore
2018-11-21 0:44 ` [PATCH v2 16/15] syscall_get_arch: add "struct task_struct *" argument Dmitry V. Levin
2018-11-21 0:44 ` Dmitry V. Levin
2018-11-21 15:15 ` Andy Lutomirski
2018-11-21 15:15 ` Andy Lutomirski
2018-11-21 15:47 ` Palmer Dabbelt
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 ` Dmitry V. Levin
2018-11-21 19:00 ` Dmitry V. Levin
2018-11-21 19:35 ` [PATCH v2 16/15 v2] " Dmitry V. Levin
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] " Michael Ellerman
2018-11-27 10:34 ` Michael Ellerman
Reply instructions:
You may reply publicly 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=mhng-11f5dbf6-0aee-4f6e-b184-63536ecc3ac5@palmer-si-x1c4 \
--to=palmer@sifive.com \
--cc=linux-riscv@lists.infradead.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).