From d876d1ca221112674a7e9a6ba0fee65b947fdfa7 Mon Sep 17 00:00:00 2001 From: Wojciech Dubowik Date: Fri, 8 Mar 2019 09:36:12 +0100 Subject: [PATCH] procd: trace: Define syscall registers for powerpc platform 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 --- 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.30.2