diff options
author | Eduardo Otubo <otubo@redhat.com> | 2017-03-13 22:16:01 +0100 |
---|---|---|
committer | Eduardo Otubo <otubo@redhat.com> | 2017-09-15 10:15:06 +0200 |
commit | 995a226f880b807e05240e8752d6ce65679775be (patch) | |
tree | 52c583395208ab69f6deb0bed685aeb3eefefbe0 /vl.c | |
parent | 73a1e647256b09734ce64ef7a6001a0db03f7106 (diff) |
seccomp: add spawn argument to command line
This patch adds [,spawn=deny] argument to `-sandbox on' option. It
blacklists fork and execve system calls, avoiding Qemu to spawn new
threads or processes.
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -280,6 +280,10 @@ static QemuOptsList qemu_sandbox_opts = { .name = "elevateprivileges", .type = QEMU_OPT_STRING, }, + { + .name = "spawn", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -1083,6 +1087,18 @@ static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp) } } + value = qemu_opt_get(opts, "spawn"); + if (value) { + if (g_str_equal(value, "deny")) { + seccomp_opts |= QEMU_SECCOMP_SET_SPAWN; + } else if (g_str_equal(value, "allow")) { + /* default value */ + } else { + error_report("invalid argument for spawn"); + return -1; + } + } + if (seccomp_start(seccomp_opts) < 0) { error_report("failed to install seccomp syscall filter " "in the kernel"); |