summaryrefslogtreecommitdiffstats
path: root/src/shared/seccomp-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-15 12:46:56 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-15 15:46:41 +0100
commit67fb5f338fad27250eeed502dd7d3675514d1d63 (patch)
treeb48097d6cf63a02928b38ff26e66c35c2c216380 /src/shared/seccomp-util.c
parentseccomp: shm{get,at,dt} now have their own numbers everywhere (diff)
downloadsystemd-67fb5f338fad27250eeed502dd7d3675514d1d63.tar.xz
systemd-67fb5f338fad27250eeed502dd7d3675514d1d63.zip
seccomp: allow shmat to be a separate syscall on architectures which use a multiplexer
After https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d6040d46817, those syscalls have their separate numbers and we can block them. But glibc might still use the old ones. So let's just do a best-effort block and not assume anything about how effective it is.
Diffstat (limited to 'src/shared/seccomp-util.c')
-rw-r--r--src/shared/seccomp-util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c
index 714734ad61..905be0f6a9 100644
--- a/src/shared/seccomp-util.c
+++ b/src/shared/seccomp-util.c
@@ -1519,6 +1519,7 @@ int seccomp_memory_deny_write_execute(void) {
case SCMP_ARCH_X86:
filter_syscall = SCMP_SYS(mmap2);
block_syscall = SCMP_SYS(mmap);
+ shmat_syscall = SCMP_SYS(shmat);
break;
case SCMP_ARCH_PPC:
@@ -1585,7 +1586,7 @@ int seccomp_memory_deny_write_execute(void) {
continue;
#endif
- if (shmat_syscall != 0) {
+ if (shmat_syscall > 0) {
r = add_seccomp_syscall_filter(seccomp, arch, SCMP_SYS(shmat),
1,
SCMP_A2(SCMP_CMP_MASKED_EQ, SHM_EXEC, SHM_EXEC));