From bd2ab3f4f67d51c56d6d2813e8ae4802c5a59575 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Dec 2016 14:26:55 +0100 Subject: [PATCH 1/1] seccomp: add two new filter sets: @reboot and @swap These groupe reboot()/kexec() and swapon()/swapoff() respectively --- man/systemd.exec.xml | 8 ++++++++ src/shared/seccomp-util.c | 15 +++++++++++++++ src/shared/seccomp-util.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 812e6155306..202b912b555 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -1424,10 +1424,18 @@ @raw-io Raw I/O port access (ioperm2, iopl2, pciconfig_read(), …) + + @reboot + System calls for rebooting and reboot preparation (reboot2, kexec(), …) + @resources System calls for changing resource limits, memory and scheduling parameters (setrlimit2, setpriority2, …) + + @swap + System calls for enabling/disabling swap devices (swapon2, swapoff2) + diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 66b72b2b271..28c2079f300 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -566,6 +566,14 @@ const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = { "s390_pci_mmio_write\0" #endif }, + [SYSCALL_FILTER_SET_REBOOT] = { + .name = "@reboot", + .help = "Reboot and reboot preparation/kexec", + .value = + "kexec\0" + "kexec_file_load\0" + "reboot\0" + }, [SYSCALL_FILTER_SET_RESOURCES] = { /* Alter resource settings */ .name = "@resources", @@ -582,6 +590,13 @@ const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = { "sched_setattr\0" "prlimit64\0" }, + [SYSCALL_FILTER_SET_SWAP] = { + .name = "@swap", + .help = "Enable/disable swap devices", + .value = + "swapoff\0" + "swapon\0" + }, }; const SyscallFilterSet *syscall_filter_set_find(const char *name) { diff --git a/src/shared/seccomp-util.h b/src/shared/seccomp-util.h index 01cf331b293..2e9980e74b7 100644 --- a/src/shared/seccomp-util.h +++ b/src/shared/seccomp-util.h @@ -56,7 +56,9 @@ enum { SYSCALL_FILTER_SET_PRIVILEGED, SYSCALL_FILTER_SET_PROCESS, SYSCALL_FILTER_SET_RAW_IO, + SYSCALL_FILTER_SET_REBOOT, SYSCALL_FILTER_SET_RESOURCES, + SYSCALL_FILTER_SET_SWAP, _SYSCALL_FILTER_SET_MAX }; -- 2.39.2