Skip to contentSkip to conversation

nds32: define syscall_get_arch()

PATCH Applied Dmitry V. Levin 2 participants 2 messages Mar 17, 2019 – Mar 21, 2019 Audit

lore
Share & tools
lore
#0 lore raw

PATCH v2 9/13 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.

---

Notes:
v2: added Acked-by

 arch/nds32/include/asm/syscall.h | 9 +++++++++
 include/uapi/linux/audit.h       | 2 ++
 2 files changed, 11 insertions(+)
arch/nds32/include/asm/syscall.h +9 -0
index f7e5e86765fe..cc56a3962f8b 100644
@@ -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 */
include/uapi/linux/audit.h +2 -0
index fc94e74c8b77..fb0529da4d49 100644
@@ -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)
Signature · 1 line
ldv
maintainer Applied
#1 lore raw
Quoted 16 lines · Dmitry V. Levin

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.

Quoted 8 lines

---

Notes:
v2: added Acked-by

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

Merged into audit/next, thanks everyone.

Signature · 2 lines
paul moore
www.paul-moore.com