aboutsummaryrefslogtreecommitdiff
path: root/qemu-seccomp.c
diff options
context:
space:
mode:
authorEduardo Otubo <otubo@redhat.com>2017-03-13 22:13:27 +0100
committerEduardo Otubo <otubo@redhat.com>2017-09-15 10:15:06 +0200
commit73a1e647256b09734ce64ef7a6001a0db03f7106 (patch)
tree522eda09d8df57747caf6acc9ecd4b3a61e4ecc3 /qemu-seccomp.c
parent2b716fa6d63a183a42b789595c3944f53c0ded7c (diff)
downloadqemu-73a1e647256b09734ce64ef7a6001a0db03f7106.zip
qemu-73a1e647256b09734ce64ef7a6001a0db03f7106.tar.gz
qemu-73a1e647256b09734ce64ef7a6001a0db03f7106.tar.bz2
seccomp: add elevateprivileges argument to command line
This patch introduces the new argument [,elevateprivileges=allow|deny|children] to the `-sandbox on'. It allows or denies Qemu process to elevate its privileges by blacklisting all set*uid|gid system calls. The 'children' option will let forks and execves run unprivileged. Signed-off-by: Eduardo Otubo <otubo@redhat.com>
Diffstat (limited to 'qemu-seccomp.c')
-rw-r--r--qemu-seccomp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/qemu-seccomp.c b/qemu-seccomp.c
index 8a5fbd2..978d66b 100644
--- a/qemu-seccomp.c
+++ b/qemu-seccomp.c
@@ -67,6 +67,17 @@ static const struct QemuSeccompSyscall blacklist[] = {
{ SCMP_SYS(sysfs), QEMU_SECCOMP_SET_OBSOLETE },
{ SCMP_SYS(uselib), QEMU_SECCOMP_SET_OBSOLETE },
{ SCMP_SYS(ustat), QEMU_SECCOMP_SET_OBSOLETE },
+ /* privileged */
+ { SCMP_SYS(setuid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setgid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setpgid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setsid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setreuid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setregid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setresuid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setresgid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setfsuid), QEMU_SECCOMP_SET_PRIVILEGED },
+ { SCMP_SYS(setfsgid), QEMU_SECCOMP_SET_PRIVILEGED },
};