diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-01-28 20:10:46 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-03-19 22:13:41 +0000 |
commit | 3e88c6f2b179062160d018aa9da2926dbd185f28 (patch) | |
tree | f81d8a31c0bb08b7d1ad2929f20d020b4f58bfd9 /jail | |
parent | 2cfc26f8456a4d5ba3836c914a742f3d00bad781 (diff) | |
download | procd-3e88c6f2b179062160d018aa9da2926dbd185f28.tar.gz |
jail/seccomp: add support for aarch64
Add support for Aarch64 in utrace and ujail.
Sort and unify architecture-specific definitions in headers.
Use new PTRACE_GET_SYSCALL_INFO call (available since Linux 5.3), for
now only for aarch64, but this may potentially unify things and get
rid of some #ifdef'ery for other platforms as well.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'jail')
-rw-r--r-- | jail/seccomp-bpf.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/jail/seccomp-bpf.h b/jail/seccomp-bpf.h index bd59ac8..077483f 100644 --- a/jail/seccomp-bpf.h +++ b/jail/seccomp-bpf.h @@ -64,19 +64,12 @@ struct seccomp_data { #define arch_nr (offsetof(struct seccomp_data, arch)) #define syscall_arg(x) (offsetof(struct seccomp_data, args[x])) -#if defined(__i386__) -# define REG_SYSCALL REG_EAX -# define ARCH_NR AUDIT_ARCH_I386 -#elif defined(__x86_64__) +#if defined(__aarch64__) +# define REG_SYSCALL regs.regs[8] +# define ARCH_NR AUDIT_ARCH_AARCH64 +#elif defined(__amd64__) # define REG_SYSCALL REG_RAX # define ARCH_NR AUDIT_ARCH_X86_64 -#elif defined(__mips__) -# define REG_SYSCALL regs[2] -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define ARCH_NR AUDIT_ARCH_MIPSEL -# else -# define ARCH_NR AUDIT_ARCH_MIPS -# endif #elif defined(__arm__) && (defined(__ARM_EABI__) || defined(__thumb__)) # define REG_SYSCALL regs.uregs[7] # if __BYTE_ORDER == __LITTLE_ENDIAN @@ -84,6 +77,16 @@ struct seccomp_data { # else # define ARCH_NR AUDIT_ARCH_ARMEB # endif +#elif defined(__i386__) +# define REG_SYSCALL REG_EAX +# define ARCH_NR AUDIT_ARCH_I386 +#elif defined(__mips__) +# define REG_SYSCALL regs[2] +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define ARCH_NR AUDIT_ARCH_MIPSEL +# else +# define ARCH_NR AUDIT_ARCH_MIPS +# endif #elif defined(__PPC__) # define REG_SYSCALL regs.gpr[0] # define ARCH_NR AUDIT_ARCH_PPC |