On Fri, Sep 01, 2017 at 12:58:14PM +0200, Eduardo Otubo wrote: > 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 <ot...@redhat.com> > --- > include/sysemu/seccomp.h | 3 ++- > qemu-options.hx | 12 ++++++++++-- > qemu-seccomp.c | 23 ++++++++++++++++++++++- > vl.c | 22 +++++++++++++++++++++- > 4 files changed, 55 insertions(+), 5 deletions(-) >
> @@ -1032,7 +1036,23 @@ 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 = 0x00000; > + const char *value = NULL; > + > + value = qemu_opt_get(opts, "obsolete"); > + if (value) { > + if (strcmp(value, "allow") == 0) { I would have a slight preference for g_str_equal(value, "allow") > + seccomp_opts |= QEMU_SECCOMP_SET_OBSOLETE; > + } else if (strcmp(value, "deny")) { and !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"); > + } There seem to be tabs for indent here too > + } > + > + if (seccomp_start(seccomp_opts) < 0) { > error_report("failed to install seccomp syscall filter " > "in the kernel"); > return -1; > -- > 2.13.5 > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|