Skip to contentSkip to conversation

sandbox: disable -sandbox if CONFIG_SECCOMP undefined

PATCH New Yi Min Zhao 1 participant 1 message May 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 sandbox: disable -sandbox if CONFIG_SECCOMP undefined

If CONFIG_SECCOMP is undefined, the option 'elevateprivileges' remains compiled. This would make libvirt set the corresponding capability and then trigger failure during guest startup. This patch moves the code regarding seccomp command line options to qemu-seccomp.c file and wraps qemu_opts_foreach finding sandbox option with CONFIG_SECCOMP. Because parse_sandbox() is moved into qemu-seccomp.c file, change seccomp_start() to static function.

---
 include/sysemu/seccomp.h |   3 +-
 qemu-seccomp.c           | 121 ++++++++++++++++++++++++++++++++++++++++++++-
 vl.c                     | 124 +++--------------------------------------------
 3 files changed, 130 insertions(+), 118 deletions(-)
include/sysemu/seccomp.h +2 -1
index 9b092aa23f..fe859894f6 100644
@@ -21,5 +21,6 @@
 #define QEMU_SECCOMP_SET_SPAWN       (1 << 3)
 #define QEMU_SECCOMP_SET_RESOURCECTL (1 << 4)
 
-int seccomp_start(uint32_t seccomp_opts);
+int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp);
+
 #endif
qemu-seccomp.c +120 -1

136 lines not on this page · raw message

vl.c +8 -116

170 lines not on this page · raw message

Signature · 1 line
Yi Min