From f6e0638b0fd05b0c69109180d27e25e710c389c22a8e00a6b64edcb368e8f001 Mon Sep 17 00:00:00 2001 From: Jordi Massaguer Date: Mon, 11 Jul 2016 09:10:03 +0000 Subject: [PATCH] Accepting request 407597 from home:chbrauner:branches:Virtualization:containers OBS-URL: https://build.opensuse.org/request/show/407597 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxcfs?expand=0&rev=2 --- ...empty-entries-under-proc-self-cgroup.patch | 60 +++++++++++++++++++ lxcfs.changes | 5 ++ lxcfs.spec | 2 + 3 files changed, 67 insertions(+) create mode 100644 0001-skip-empty-entries-under-proc-self-cgroup.patch diff --git a/0001-skip-empty-entries-under-proc-self-cgroup.patch b/0001-skip-empty-entries-under-proc-self-cgroup.patch new file mode 100644 index 0000000..4026dbb --- /dev/null +++ b/0001-skip-empty-entries-under-proc-self-cgroup.patch @@ -0,0 +1,60 @@ +From a67719f64d07d7fee96b1e145a03659fe4db0c6e Mon Sep 17 00:00:00 2001 +From: Christian Brauner +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 +--- + bindings.c | 8 ++++++++ + lxcfs.c | 8 ++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/bindings.c b/bindings.c +index cb98e12..8186ca9 100644 +--- a/bindings.c ++++ b/bindings.c +@@ -3951,6 +3951,14 @@ static void __attribute__((constructor)) collect_subsystems(void) + goto out; + *p2 = '\0'; + ++ /* With cgroupv2 /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. ++ */ ++ if (!strcmp(p, "")) ++ continue; ++ + if (!store_hierarchy(line, p)) + goto out; + } +diff --git a/lxcfs.c b/lxcfs.c +index 7455267..1d19a10 100644 +--- a/lxcfs.c ++++ b/lxcfs.c +@@ -859,6 +859,14 @@ static bool do_mount_cgroups(void) + goto out; + *p2 = '\0'; + ++ /* With cgroupv2 /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. ++ */ ++ if (!strcmp(p, "")) ++ continue; ++ + if (!do_mount_cgroup(p)) + goto out; + } +-- +2.8.4 + diff --git a/lxcfs.changes b/lxcfs.changes index e193fa1..597d53a 100644 --- a/lxcfs.changes +++ b/lxcfs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Jul 10 09:34:39 UTC 2016 - cbrauner@suse.com + +- add 0001-skip-empty-entries-under-proc-self-cgroup.patch + ------------------------------------------------------------------- Thu Jul 7 16:13:57 UTC 2016 - cbrauner@suse.de diff --git a/lxcfs.spec b/lxcfs.spec index 631f6a3..8ec9da8 100644 --- a/lxcfs.spec +++ b/lxcfs.spec @@ -23,6 +23,7 @@ Summary: FUSE filesystem for LXC Url: http://linuxcontainers.org Group: System/Management Source: https://linuxcontainers.org/downloads/%{name}/%{name}-%{version}.tar.gz +Patch: 0001-skip-empty-entries-under-proc-self-cgroup.patch BuildRequires: pkg-config BuildRequires: pkgconfig(fuse) BuildRequires: pam-devel @@ -58,6 +59,7 @@ command line. %prep %setup -q +%patch -p1 %build %configure --with-distro=suse