2019-01-09 12:45:33

by Dmitry V. Levin

[permalink] [raw]
Subject: [PATCH 09/14] nds32: define syscall_get_arch()

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <[email protected]>
Cc: Elvira Khabirova <[email protected]>
Cc: Eugene Syromyatnikov <[email protected]>
Cc: Greentime Hu <[email protected]>
Cc: Vincent Chen <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: [email protected]
Signed-off-by: Dmitry V. Levin <[email protected]>
---
arch/nds32/include/asm/syscall.h | 9 +++++++++
include/uapi/linux/audit.h | 2 ++
2 files changed, 11 insertions(+)

diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index f7e5e86765fe..cc56a3962f8b 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -5,6 +5,7 @@
#ifndef _ASM_NDS32_SYSCALL_H
#define _ASM_NDS32_SYSCALL_H 1

+#include <uapi/linux/audit.h>
#include <linux/err.h>
struct task_struct;
struct pt_regs;
@@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,

memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
}
+
+static inline int
+syscall_get_arch(void)
+{
+ return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+ ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
+}
+
#endif /* _ASM_NDS32_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index b1602dcc13bc..1568ddc1c945 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -401,6 +401,8 @@ enum {
#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
+#define AUDIT_ARCH_NDS32 (EM_NDS32|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_NDS32BE (EM_NDS32)
#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
#define AUDIT_ARCH_PARISC (EM_PARISC)
#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
--
ldv


2019-02-27 15:33:18

by Dmitry V. Levin

[permalink] [raw]
Subject: [PATCH 09/14] nds32: define syscall_get_arch()

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <[email protected]>
Cc: Elvira Khabirova <[email protected]>
Cc: Eugene Syromyatnikov <[email protected]>
Cc: Greentime Hu <[email protected]>
Cc: Vincent Chen <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: [email protected]
Signed-off-by: Dmitry V. Levin <[email protected]>
---
This is just a gentle ping, the patch is unchanged.

arch/nds32/include/asm/syscall.h | 9 +++++++++
include/uapi/linux/audit.h | 2 ++
2 files changed, 11 insertions(+)

diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index f7e5e86765fe..cc56a3962f8b 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -5,6 +5,7 @@
#ifndef _ASM_NDS32_SYSCALL_H
#define _ASM_NDS32_SYSCALL_H 1

+#include <uapi/linux/audit.h>
#include <linux/err.h>
struct task_struct;
struct pt_regs;
@@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,

memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
}
+
+static inline int
+syscall_get_arch(void)
+{
+ return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+ ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
+}
+
#endif /* _ASM_NDS32_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index b1602dcc13bc..1568ddc1c945 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -401,6 +401,8 @@ enum {
#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
+#define AUDIT_ARCH_NDS32 (EM_NDS32|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_NDS32BE (EM_NDS32)
#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
#define AUDIT_ARCH_PARISC (EM_PARISC)
#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
--
ldv

2019-03-04 23:51:57

by Vincent Chen

[permalink] [raw]
Subject: Re: [PATCH 09/14] nds32: define syscall_get_arch()

Dmitry V. Levin <[email protected]> 於 2019年2月27日 週三 下午11:30寫道:

>
> syscall_get_arch() is required to be implemented on all architectures
> in addition to already implemented syscall_get_nr(),
> syscall_get_arguments(), syscall_get_error(), and
> syscall_get_return_value() functions in order to extend the generic
> ptrace API with PTRACE_GET_SYSCALL_INFO request.
>
> Acked-by: Paul Moore <[email protected]>
> Cc: Elvira Khabirova <[email protected]>
> Cc: Eugene Syromyatnikov <[email protected]>
> Cc: Greentime Hu <[email protected]>
> Cc: Vincent Chen <[email protected]>
> Cc: Oleg Nesterov <[email protected]>
> Cc: Andy Lutomirski <[email protected]>
> Cc: [email protected]
> Signed-off-by: Dmitry V. Levin <[email protected]>
> ---
> This is just a gentle ping, the patch is unchanged.
>
> arch/nds32/include/asm/syscall.h | 9 +++++++++
> include/uapi/linux/audit.h | 2 ++
> 2 files changed, 11 insertions(+)
>
> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index f7e5e86765fe..cc56a3962f8b 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -5,6 +5,7 @@
> #ifndef _ASM_NDS32_SYSCALL_H
> #define _ASM_NDS32_SYSCALL_H 1
>
> +#include <uapi/linux/audit.h>
> #include <linux/err.h>
> struct task_struct;
> struct pt_regs;
> @@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
>
> memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> }
> +
> +static inline int
> +syscall_get_arch(void)
> +{
> + return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
> + ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
> +}
> +
> #endif /* _ASM_NDS32_SYSCALL_H */
> diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> index b1602dcc13bc..1568ddc1c945 100644
> --- a/include/uapi/linux/audit.h
> +++ b/include/uapi/linux/audit.h
> @@ -401,6 +401,8 @@ enum {
> #define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
> #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
> __AUDIT_ARCH_CONVENTION_MIPS64_N32)
> +#define AUDIT_ARCH_NDS32 (EM_NDS32|__AUDIT_ARCH_LE)
> +#define AUDIT_ARCH_NDS32BE (EM_NDS32)
> #define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
> #define AUDIT_ARCH_PARISC (EM_PARISC)
> #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
> --
> ldv

Thanks for fixing this.

Acked-by Vincent Chen

2019-03-06 06:51:52

by Greentime Hu

[permalink] [raw]
Subject: Re: [PATCH 09/14] nds32: define syscall_get_arch()

Vincent Chen <[email protected]> 於 2019年3月5日 週二 上午7:50寫道:
>
> Dmitry V. Levin <[email protected]> 於 2019年2月27日 週三 下午11:30寫道:
>
> >
> > syscall_get_arch() is required to be implemented on all architectures
> > in addition to already implemented syscall_get_nr(),
> > syscall_get_arguments(), syscall_get_error(), and
> > syscall_get_return_value() functions in order to extend the generic
> > ptrace API with PTRACE_GET_SYSCALL_INFO request.
> >
> > Acked-by: Paul Moore <[email protected]>
> > Cc: Elvira Khabirova <[email protected]>
> > Cc: Eugene Syromyatnikov <[email protected]>
> > Cc: Greentime Hu <[email protected]>
> > Cc: Vincent Chen <[email protected]>
> > Cc: Oleg Nesterov <[email protected]>
> > Cc: Andy Lutomirski <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Dmitry V. Levin <[email protected]>
> > ---
> > This is just a gentle ping, the patch is unchanged.
> >
> > arch/nds32/include/asm/syscall.h | 9 +++++++++
> > include/uapi/linux/audit.h | 2 ++
> > 2 files changed, 11 insertions(+)
> >
> > diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> > index f7e5e86765fe..cc56a3962f8b 100644
> > --- a/arch/nds32/include/asm/syscall.h
> > +++ b/arch/nds32/include/asm/syscall.h
> > @@ -5,6 +5,7 @@
> > #ifndef _ASM_NDS32_SYSCALL_H
> > #define _ASM_NDS32_SYSCALL_H 1
> >
> > +#include <uapi/linux/audit.h>
> > #include <linux/err.h>
> > struct task_struct;
> > struct pt_regs;
> > @@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> >
> > memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> > }
> > +
> > +static inline int
> > +syscall_get_arch(void)
> > +{
> > + return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
> > + ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
> > +}
> > +
> > #endif /* _ASM_NDS32_SYSCALL_H */
> > diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> > index b1602dcc13bc..1568ddc1c945 100644
> > --- a/include/uapi/linux/audit.h
> > +++ b/include/uapi/linux/audit.h
> > @@ -401,6 +401,8 @@ enum {
> > #define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
> > #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
> > __AUDIT_ARCH_CONVENTION_MIPS64_N32)
> > +#define AUDIT_ARCH_NDS32 (EM_NDS32|__AUDIT_ARCH_LE)
> > +#define AUDIT_ARCH_NDS32BE (EM_NDS32)
> > #define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
> > #define AUDIT_ARCH_PARISC (EM_PARISC)
> > #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
> > --
> > ldv
>
> Thanks for fixing this.
>
> Acked-by Vincent Chen

Thank you. I add his email address. :P

Acked-by: Vincent Chen <[email protected]>
Acked-by: Greentime Hu <[email protected]>