diff options
author | Eduardo Otubo <otubo@redhat.com> | 2017-03-13 22:18:51 +0100 |
---|---|---|
committer | Eduardo Otubo <otubo@redhat.com> | 2017-09-15 10:15:06 +0200 |
commit | 24f8cdc5722476e12d8e39d71f66311b4fa971c1 (patch) | |
tree | 46fd71cfaaa2c1632bfce0d683941c15c84970f1 /vl.c | |
parent | 995a226f880b807e05240e8752d6ce65679775be (diff) |
seccomp: add resourcecontrol argument to command line
This patch adds [,resourcecontrol=deny] to `-sandbox on' option. It
blacklists all process affinity and scheduler priority system calls to
avoid any bigger of the process.
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
@@ -284,6 +284,10 @@ static QemuOptsList qemu_sandbox_opts = { .name = "spawn", .type = QEMU_OPT_STRING, }, + { + .name = "resourcecontrol", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -1099,6 +1103,18 @@ static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp) } } + value = qemu_opt_get(opts, "resourcecontrol"); + if (value) { + if (g_str_equal(value, "deny")) { + seccomp_opts |= QEMU_SECCOMP_SET_RESOURCECTL; + } else if (g_str_equal(value, "allow")) { + /* default value */ + } else { + error_report("invalid argument for resourcecontrol"); + return -1; + } + } + if (seccomp_start(seccomp_opts) < 0) { error_report("failed to install seccomp syscall filter " "in the kernel"); |