From 4f6d0cf8078962c89b54128be902a24de266c3ec Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Wed, 24 Jul 2019 19:58:48 -0400 Subject: [PATCH 1/2] src/basic/missing_syscall: add s390 syscall number for __NR_pkey_mprotect The syscall number for s390 was added to the kernel at: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b41c51c8e194c0bdfb4b1778a137aea8246c86cd --- src/basic/missing_syscall.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index f590b91c66..f9a541af80 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -391,6 +391,8 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) { # define __NR_pkey_mprotect 394 # elif defined __powerpc__ # define __NR_pkey_mprotect 386 +# elif defined __s390__ +# define __NR_pkey_mprotect 384 # elif defined _MIPS_SIM # if _MIPS_SIM == _MIPS_SIM_ABI32 # define __NR_pkey_mprotect 4363 From 57311925aa91d040b2be6ffcf7b56abd5c15e206 Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Wed, 24 Jul 2019 20:48:49 -0400 Subject: [PATCH 2/2] src/shared/seccomp-util.c: Add mmap definitions for s390 --- src/shared/seccomp-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 498e8ee84a..4e605523d9 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -1521,6 +1521,7 @@ int seccomp_memory_deny_write_execute(void) { switch (arch) { case SCMP_ARCH_X86: + case SCMP_ARCH_S390: filter_syscall = SCMP_SYS(mmap2); block_syscall = SCMP_SYS(mmap); shmat_syscall = SCMP_SYS(shmat); @@ -1545,13 +1546,14 @@ int seccomp_memory_deny_write_execute(void) { case SCMP_ARCH_X86_64: case SCMP_ARCH_X32: case SCMP_ARCH_AARCH64: - filter_syscall = SCMP_SYS(mmap); /* amd64, x32, and arm64 have only mmap */ + case SCMP_ARCH_S390X: + filter_syscall = SCMP_SYS(mmap); /* amd64, x32, s390x, and arm64 have only mmap */ shmat_syscall = SCMP_SYS(shmat); break; /* Please add more definitions here, if you port systemd to other architectures! */ -#if !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__) && !defined(__powerpc64__) && !defined(__arm__) && !defined(__aarch64__) +#if !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__) && !defined(__powerpc64__) && !defined(__arm__) && !defined(__aarch64__) && !defined(__s390__) && !defined(__s390x__) #warning "Consider adding the right mmap() syscall definitions here!" #endif }