[libvirt] [RFC][PATCH] lxc: drop CAP_SYS_BOOT capability to prevent rebooting from inside containers

Matthias Bolte matthias.bolte at googlemail.com
Mon May 11 15:59:45 UTC 2009


I needed to apply the following two small changes to get it compile.

On my system (Ubuntu 9.04) I don't have a sys/capability.h header, but
a linux/capability.h header as part of the linux-libc-dev package.

The second change makes the code compile with -Werror, because vmDef
is not used in the lxcContainerDropCapabilities function.

diff --git a/src/lxc_container.c b/src/lxc_container.c
index 3687750..a2b3051 100644
--- a/src/lxc_container.c
+++ b/src/lxc_container.c
@@ -42,7 +42,7 @@
 #include <linux/fs.h>

 #include <sys/prctl.h>
-#include <sys/capability.h>
+#include <linux/capability.h>

 #include "virterror_internal.h"
 #include "logging.h"
@@ -642,7 +642,7 @@ static int lxcContainerSetupMounts(virDomainDefPtr vmDef,
         return lxcContainerSetupExtraMounts(vmDef);

-static int lxcContainerDropCapabilities( virDomainDefPtr vmDef )
+static int lxcContainerDropCapabilities( virDomainDefPtr vmDef
     int i;
     const struct {

More information about the libvir-list mailing list