mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
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>
This commit is contained in:
24
vl.c
24
vl.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user