[lxc-devel] [lxcfs/master] skip empty entries under /proc/self/cgroup

brauner on Github lxc-bot at linuxcontainers.org
Sat Jul 9 11:27:38 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 650 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160709/ba18df8b/attachment.bin>
-------------- next part --------------
From b27b9f5e8c9af1350176a53ec7bcd7be89496e7c Mon Sep 17 00:00:00 2001
From: Christian Brauner <cbrauner at suse.de>
Date: Sat, 9 Jul 2016 13:19:06 +0200
Subject: [PATCH] skip empty entries under /proc/self/cgroup

If cgroupv2 is enabled either alone or together with legacy hierarchies
/proc/self/cgroup can contain entries of the form:

        0::/

This will cause lxcfs to fail the cgroup mounts because it parses out the empty
string "" and later on passes it to mount(). Let's skip such entries.

Signed-off-by: Christian Brauner <cbrauner at suse.de>
---
 bindings.c | 3 +++
 lxcfs.c    | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/bindings.c b/bindings.c
index cb98e12..5fdc3d0 100644
--- a/bindings.c
+++ b/bindings.c
@@ -3951,6 +3951,9 @@ static void __attribute__((constructor)) collect_subsystems(void)
 			goto out;
 		*p2 = '\0';
 
+		if (!strcmp(p, ""))
+			continue;
+
 		if (!store_hierarchy(line, p))
 			goto out;
 	}
diff --git a/lxcfs.c b/lxcfs.c
index 7455267..cfcb281 100644
--- a/lxcfs.c
+++ b/lxcfs.c
@@ -859,6 +859,9 @@ static bool do_mount_cgroups(void)
 			goto out;
 		*p2 = '\0';
 
+		if (!strcmp(p, ""))
+			continue;
+
 		if (!do_mount_cgroup(p))
 			goto out;
 	}


More information about the lxc-devel mailing list