Patchwork [v6,3/3] Adding seccomp calls to vl.c

login
register
mail settings
Submitter Eduardo Otubo
Date Aug. 13, 2012, 7:01 p.m.
Message ID <1344884468-11065-4-git-send-email-otubo@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/177028/
State New
Headers show

Comments

Eduardo Otubo - Aug. 13, 2012, 7:01 p.m.
v1:
 * Full seccomp calls and data included in vl.c

v2:
 * Full seccomp calls and data removed from vl.c and put into separate
   qemu-seccomp.[ch] file.

Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
---
 vl.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Patch

diff --git a/vl.c b/vl.c
index 91076f0..2c62efc 100644
--- a/vl.c
+++ b/vl.c
@@ -63,6 +63,11 @@ 
 #include <linux/ppdev.h>
 #include <linux/parport.h>
 #endif
+
+#ifdef CONFIG_SECCOMP
+#include "qemu-seccomp.h"
+#endif
+
 #ifdef __sun__
 #include <sys/stat.h>
 #include <sys/ethernet.h>
@@ -2299,6 +2304,14 @@  int main(int argc, char **argv, char **envp)
     const char *trace_events = NULL;
     const char *trace_file = NULL;
 
+#ifdef CONFIG_SECCOMP
+    if (seccomp_start() < 0) {
+        fprintf(stderr,
+                "seccomp: failed to install syscall filter in the kernel\n");
+        exit(1);
+    }
+#endif
+
     atexit(qemu_run_exit_notifiers);
     error_set_progname(argv[0]);