Skip to contentSkip to conversation

seccomp branch queue

GIT PULL Eduardo Otubo 1 participant 2 messages Sep 14, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit 19b599f7664b2ebfd0f405fb79c14dd241557452:

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2' into staging (2018-08-27 16:44:20 +0100)

are available in the Git repository at:

https://github.com/otubo/qemu.git tags/pull-seccomp-20180914

for you to fetch changes up to d3228ed3829981047138bbaff332026f9d64f337:

seccomp: check TSYNC host capability (2018-09-14 15:01:55 +0200)

----------------------------------------------------------------
pull-seccomp-20180914

----------------------------------------------------------------
Marc-André Lureau (1):
seccomp: check TSYNC host capability

 qemu-seccomp.c | 19 ++++++++++++++++++-
 vl.c           |  4 ++--
 2 files changed, 20 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

[Qemu-devel] [PULL 1/1] seccomp: check TSYNC host capability

From: Marc-André Lureau <[email protected]>

Remove -sandbox option if the host is not capable of TSYNC, since the sandbox will fail at setup time otherwise. This will help libvirt, for ex, to figure out if -sandbox will work.

---
 qemu-seccomp.c | 19 ++++++++++++++++++-
 vl.c           |  4 ++--
 2 files changed, 20 insertions(+), 3 deletions(-)
qemu-seccomp.c +18 -1
index 4729eb107f..1baa5c69ed 100644
@@ -282,7 +282,24 @@ static QemuOptsList qemu_sandbox_opts = {
 
 static void seccomp_register(void)
 {
-    qemu_add_opts(&qemu_sandbox_opts);
+    bool add = false;
+
+    /* FIXME: use seccomp_api_get() >= 2 check when released */
+
+#if defined(SECCOMP_FILTER_FLAG_TSYNC)
+    int check;
+
+    /* check host TSYNC capability, it returns errno == ENOSYS if unavailable */
+    check = qemu_seccomp(SECCOMP_SET_MODE_FILTER,
+                         SECCOMP_FILTER_FLAG_TSYNC, NULL);
+    if (check < 0 && errno == EFAULT) {
+        add = true;
+    }
+#endif
+
+    if (add) {
+        qemu_add_opts(&qemu_sandbox_opts);
+    }
 }
 opts_init(seccomp_register);
 #endif
vl.c +2 -2
index 5ba06adf78..380ae7ba2b 100644
@@ -4007,8 +4007,8 @@ int main(int argc, char **argv, char **envp)
     }
 
 #ifdef CONFIG_SECCOMP
-    if (qemu_opts_foreach(qemu_find_opts("sandbox"),
-                          parse_sandbox, NULL, NULL)) {
+    olist = qemu_find_opts_err("sandbox", NULL);
+    if (olist && qemu_opts_foreach(olist, parse_sandbox, NULL, NULL)) {
         exit(1);
     }
 #endif
Signature · 1 line
2.17.1