[OpenWrt-Devel] [PATCH 1/2] procd: trace: Define syscall registers for powerpc platform
Wojciech Dubowik
Wojciech.Dubowik at neratec.com
Fri Mar 8 03:36:12 EST 2019
According to manpage the syscall nr is stored in r0
and return value in r3 for powerpc. Define it so we
can use seccomp and utrace on powerpc.
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik at neratec.com>
---
jail/seccomp-bpf.h | 3 +++
trace/trace.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/jail/seccomp-bpf.h b/jail/seccomp-bpf.h
index fc3ffe7..fd6b3e2 100644
--- a/jail/seccomp-bpf.h
+++ b/jail/seccomp-bpf.h
@@ -81,6 +81,9 @@ struct seccomp_data {
# else
# define ARCH_NR AUDIT_ARCH_ARMEB
# endif
+#elif defined(__PPC__)
+# define REG_SYSCALL regs.gpr[0]
+# define ARCH_NR AUDIT_ARCH_PPC
#else
# warning "Platform does not support seccomp filter yet"
# define REG_SYSCALL 0
diff --git a/trace/trace.c b/trace/trace.c
index 665c22e..78b99dd 100644
--- a/trace/trace.c
+++ b/trace/trace.c
@@ -58,6 +58,9 @@
# if defined(__ARM_EABI__)
# define reg_retval_nr _offsetof(struct user, regs.uregs[0])
# endif
+#elif defined(__PPC__)
+#define reg_syscall_nr _offsetof(struct user, regs.gpr[0])
+#define reg_retval_nr _offsetof(struct user, regs.gpr[3])
#else
#error tracing is not supported on this architecture
#endif
--
2.17.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list