Browse Source

seccomp: add cacheflush to whitelist

cacheflush is an arm-specific syscall that qemu built for arm
uses. Add it to the whitelist, but only if we're linking with
a recent enough libseccomp.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Andrew Jones 9 years ago
parent
commit
47d2067af3
1 changed files with 12 additions and 1 deletions
  1. 12 1
      qemu-seccomp.c

+ 12 - 1
qemu-seccomp.c

@@ -16,6 +16,14 @@
 #include <seccomp.h>
 #include <seccomp.h>
 #include "sysemu/seccomp.h"
 #include "sysemu/seccomp.h"
 
 
+#if SCMP_VER_MAJOR >= 3
+  #define HAVE_CACHEFLUSH
+#elif SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR >= 3
+  #define HAVE_CACHEFLUSH
+#elif SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR == 2 && SCMP_VER_MICRO >= 3
+  #define HAVE_CACHEFLUSH
+#endif
+
 struct QemuSeccompSyscall {
 struct QemuSeccompSyscall {
     int32_t num;
     int32_t num;
     uint8_t priority;
     uint8_t priority;
@@ -238,7 +246,10 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = {
     { SCMP_SYS(inotify_init1), 240 },
     { SCMP_SYS(inotify_init1), 240 },
     { SCMP_SYS(inotify_add_watch), 240 },
     { SCMP_SYS(inotify_add_watch), 240 },
     { SCMP_SYS(mbind), 240 },
     { SCMP_SYS(mbind), 240 },
-    { SCMP_SYS(memfd_create), 240 }
+    { SCMP_SYS(memfd_create), 240 },
+#ifdef HAVE_CACHEFLUSH
+    { SCMP_SYS(cacheflush), 240 },
+#endif
 };
 };
 
 
 int seccomp_start(void)
 int seccomp_start(void)