diff options
author | Eduardo Otubo <otubo@redhat.com> | 2017-03-01 23:17:29 +0100 |
---|---|---|
committer | Eduardo Otubo <otubo@redhat.com> | 2017-09-15 10:15:05 +0200 |
commit | 2b716fa6d63a183a42b789595c3944f53c0ded7c (patch) | |
tree | a460580478014b6b51768ba9c2e407c11fff8875 /vl.c | |
parent | 1bd6152ae23549032ef4aca0d3d350512f012f05 (diff) |
seccomp: add obsolete argument to command line
This patch introduces the argument [,obsolete=allow] to the `-sandbox on'
option. It allows Qemu to run safely on old system that still relies on
old system calls.
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -271,6 +271,10 @@ static QemuOptsList qemu_sandbox_opts = { .name = "enable", .type = QEMU_OPT_BOOL, }, + { + .name = "obsolete", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -1034,7 +1038,25 @@ static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp) { if (qemu_opt_get_bool(opts, "enable", false)) { #ifdef CONFIG_SECCOMP - if (seccomp_start() < 0) { + uint32_t seccomp_opts = QEMU_SECCOMP_SET_DEFAULT + | QEMU_SECCOMP_SET_OBSOLETE; + const char *value = NULL; + + value = qemu_opt_get(opts, "obsolete"); + if (value) { + if (g_str_equal(value, "allow")) { + seccomp_opts &= ~QEMU_SECCOMP_SET_OBSOLETE; + } else if (g_str_equal(value, "deny")) { + /* this is the default option, this if is here + * to provide a little bit of consistency for + * the command line */ + } else { + error_report("invalid argument for obsolete"); + return -1; + } + } + + if (seccomp_start(seccomp_opts) < 0) { error_report("failed to install seccomp syscall filter " "in the kernel"); return -1; |