Hello community,

here is the log from the commit of package lxcfs for openSUSE:Factory checked 
in at 2017-11-01 11:10:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lxcfs (Old)
 and      /work/SRC/openSUSE:Factory/.lxcfs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lxcfs"

Wed Nov  1 11:10:06 2017 rev:4 rq:537976 version:2.0.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/lxcfs/lxcfs.changes      2017-05-31 
12:20:20.803280120 +0200
+++ /work/SRC/openSUSE:Factory/.lxcfs.new/lxcfs.changes 2017-11-01 
11:10:12.884509953 +0100
@@ -1,0 +2,18 @@
+Tue Oct 31 19:34:47 UTC 2017 - [email protected]
+
+- update to version 2.0.8
+  This is the eigth bugfix release for LXCFS 2.0. This includes the following 
bugfixes:
+  * bindings: Add mountpoint for unified hierarchy
+  * bindings: Calculate uptime via proc//stat
+  * bindings: Revert virtualization of 'btime' field due to regressions in ps
+  * doc: Update README
+  * init: Add cgroupfs-mount to Should-Start/Stop sysvinit LSB headers
+  * lib: Add common fallback dlopen for liblxcfs.so
+  * lib: Fix the installation directory for liblxcfs to ${libdir}/lxcfs
+  * pam: Add a 'all' option for -c
+  * pam: Chown cgroup.procs file on unified hierarchy
+  * pam: Report back when we find a unified hierarchy
+  * tests: Fix invalid comparison
+  * uptime: Fix a problem with subsequent reads
+
+-------------------------------------------------------------------

Old:
----
  lxcfs-2.0.7.tar.gz
  lxcfs-2.0.7.tar.gz.asc

New:
----
  lxcfs-2.0.8.tar.gz
  lxcfs-2.0.8.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lxcfs.spec ++++++
--- /var/tmp/diff_new_pack.9Km13f/_old  2017-11-01 11:10:14.616446692 +0100
+++ /var/tmp/diff_new_pack.9Km13f/_new  2017-11-01 11:10:14.616446692 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           lxcfs
-Version:        2.0.7
+Version:        2.0.8
 Release:        0
 Summary:        FUSE filesystem for LXC
 License:        Apache-2.0
@@ -110,6 +110,9 @@
 %{_mandir}/man1/*
 %{_unitdir}/*
 %dir %{_localstatedir}/lib/%{name}
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/liblxcfs.la
+%{_libdir}/%{name}/liblxcfs.so
 
 # The lxcfs executable requires liblxcfs.so be installed. It calls dlopen() to
 # dynamically reload the shared library on upgrade. This is important. Do *not*

++++++ lxcfs-2.0.7.tar.gz -> lxcfs-2.0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/Makefile.am new/lxcfs-2.0.8/Makefile.am
--- old/lxcfs-2.0.7/Makefile.am 2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/Makefile.am 2017-10-19 19:06:41.000000000 +0200
@@ -22,7 +22,7 @@
 noinst_HEADERS = bindings.h macro.h
 
 sodir=$(libdir)
-lib_LTLIBRARIES = liblxcfs.la
+lxcfs_LTLIBRARIES = liblxcfs.la
 EXTRA_LTLIBRARIES = liblxcfstest.la
 
 lxcfs_SOURCES = lxcfs.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/Makefile.in new/lxcfs-2.0.8/Makefile.in
--- old/lxcfs-2.0.7/Makefile.in 2017-05-11 19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/Makefile.in 2017-10-19 19:06:46.000000000 +0200
@@ -132,9 +132,9 @@
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pamdir)" \
+am__installdirs = "$(DESTDIR)$(lxcfsdir)" "$(DESTDIR)$(pamdir)" \
        "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
-LTLIBRARIES = $(lib_LTLIBRARIES) $(pam_LTLIBRARIES)
+LTLIBRARIES = $(lxcfs_LTLIBRARIES) $(pam_LTLIBRARIES)
 liblxcfs_la_LIBADD =
 am_liblxcfs_la_OBJECTS = liblxcfs_la-bindings.lo liblxcfs_la-cpuset.lo
 liblxcfs_la_OBJECTS = $(am_liblxcfs_la_OBJECTS)
@@ -413,6 +413,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -445,7 +446,7 @@
 liblxcfstest_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared
 noinst_HEADERS = bindings.h macro.h
 sodir = $(libdir)
-lib_LTLIBRARIES = liblxcfs.la
+lxcfs_LTLIBRARIES = liblxcfs.la
 EXTRA_LTLIBRARIES = liblxcfstest.la
 lxcfs_SOURCES = lxcfs.c
 lxcfs_LDADD = -ldl
@@ -514,33 +515,33 @@
 distclean-hdr:
        -rm -f config.h stamp-h1
 
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+install-lxcfsLTLIBRARIES: $(lxcfs_LTLIBRARIES)
        @$(NORMAL_INSTALL)
-       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       @list='$(lxcfs_LTLIBRARIES)'; test -n "$(lxcfsdir)" || list=; \
        list2=; for p in $$list; do \
          if test -f $$p; then \
            list2="$$list2 $$p"; \
          else :; fi; \
        done; \
        test -z "$$list2" || { \
-         echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+         echo " $(MKDIR_P) '$(DESTDIR)$(lxcfsdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(lxcfsdir)" || exit 1; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(lxcfsdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(lxcfsdir)"; \
        }
 
-uninstall-libLTLIBRARIES:
+uninstall-lxcfsLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
-       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       @list='$(lxcfs_LTLIBRARIES)'; test -n "$(lxcfsdir)" || list=; \
        for p in $$list; do \
          $(am__strip_dir) \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall 
rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f 
"$(DESTDIR)$(libdir)/$$f"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall 
rm -f '$(DESTDIR)$(lxcfsdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f 
"$(DESTDIR)$(lxcfsdir)/$$f"; \
        done
 
-clean-libLTLIBRARIES:
-       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-       @list='$(lib_LTLIBRARIES)'; \
+clean-lxcfsLTLIBRARIES:
+       -test -z "$(lxcfs_LTLIBRARIES)" || rm -f $(lxcfs_LTLIBRARIES)
+       @list='$(lxcfs_LTLIBRARIES)'; \
        locs=`for p in $$list; do echo $$p; done | \
              sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
              sort -u`; \
@@ -585,7 +586,7 @@
        }
 
 liblxcfs.la: $(liblxcfs_la_OBJECTS) $(liblxcfs_la_DEPENDENCIES) 
$(EXTRA_liblxcfs_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(liblxcfs_la_LINK) -rpath $(libdir) $(liblxcfs_la_OBJECTS) 
$(liblxcfs_la_LIBADD) $(LIBS)
+       $(AM_V_CCLD)$(liblxcfs_la_LINK) -rpath $(lxcfsdir) 
$(liblxcfs_la_OBJECTS) $(liblxcfs_la_LIBADD) $(LIBS)
 
 liblxcfstest.la: $(liblxcfstest_la_OBJECTS) $(liblxcfstest_la_DEPENDENCIES) 
$(EXTRA_liblxcfstest_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(liblxcfstest_la_LINK)  $(liblxcfstest_la_OBJECTS) 
$(liblxcfstest_la_LIBADD) $(LIBS)
@@ -1093,11 +1094,9 @@
 check: check-recursive
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) \
                config.h
-install-binPROGRAMS: install-libLTLIBRARIES
-
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pamdir)" 
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+       for dir in "$(DESTDIR)$(lxcfsdir)" "$(DESTDIR)$(pamdir)" 
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-recursive
@@ -1136,8 +1135,8 @@
 @HAVE_PAM_FALSE@install-data-hook:
 clean: clean-recursive
 
-clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
-       clean-libtool clean-pamLTLIBRARIES mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+       clean-lxcfsLTLIBRARIES clean-pamLTLIBRARIES mostlyclean-am
 
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-hdr distclean-libtool distclean-tags
@@ -1154,14 +1153,15 @@
 
 info-am:
 
-install-data-am: install-man install-pamLTLIBRARIES
+install-data-am: install-lxcfsLTLIBRARIES install-man \
+       install-pamLTLIBRARIES
        @$(NORMAL_INSTALL)
        $(MAKE) $(AM_MAKEFLAGS) install-data-hook
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+install-exec-am: install-binPROGRAMS
 
 install-html: install-html-recursive
 
@@ -1203,8 +1203,9 @@
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
-       uninstall-local uninstall-man uninstall-pamLTLIBRARIES
+uninstall-am: uninstall-binPROGRAMS uninstall-local \
+       uninstall-lxcfsLTLIBRARIES uninstall-man \
+       uninstall-pamLTLIBRARIES
 
 uninstall-man: uninstall-man1
 
@@ -1213,25 +1214,26 @@
 
 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
        am--refresh check check-am clean clean-binPROGRAMS \
-       clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
-       clean-pamLTLIBRARIES cscope cscopelist-am ctags ctags-am dist \
-       dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
-       dist-xz dist-zip distcheck distclean distclean-compile \
-       distclean-generic distclean-hdr distclean-libtool \
-       distclean-tags distcleancheck distdir distuninstallcheck dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-binPROGRAMS install-data install-data-am \
-       install-data-hook install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-libLTLIBRARIES install-man \
-       install-man1 install-pamLTLIBRARIES install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs installdirs-am maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
-       uninstall-libLTLIBRARIES uninstall-local uninstall-man \
-       uninstall-man1 uninstall-pamLTLIBRARIES
+       clean-cscope clean-generic clean-libtool \
+       clean-lxcfsLTLIBRARIES clean-pamLTLIBRARIES cscope \
+       cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+       dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
+       distcheck distclean distclean-compile distclean-generic \
+       distclean-hdr distclean-libtool distclean-tags distcleancheck \
+       distdir distuninstallcheck dvi dvi-am html html-am info \
+       info-am install install-am install-binPROGRAMS install-data \
+       install-data-am install-data-hook install-dvi install-dvi-am \
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-lxcfsLTLIBRARIES \
+       install-man install-man1 install-pamLTLIBRARIES install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+       uninstall-binPROGRAMS uninstall-local \
+       uninstall-lxcfsLTLIBRARIES uninstall-man uninstall-man1 \
+       uninstall-pamLTLIBRARIES
 
 .PRECIOUS: Makefile
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/bindings.c new/lxcfs-2.0.8/bindings.c
--- old/lxcfs-2.0.7/bindings.c  2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/bindings.c  2017-10-19 19:06:41.000000000 +0200
@@ -8,14 +8,17 @@
 
 #define FUSE_USE_VERSION 26
 
+#define __STDC_FORMAT_MACROS
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <fuse.h>
+#include <inttypes.h>
 #include <libgen.h>
 #include <pthread.h>
 #include <sched.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,11 +33,15 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/syscall.h>
+#include <sys/sysinfo.h>
 #include <sys/vfs.h>
 
 #include "bindings.h"
 #include "config.h" // for VERSION
 
+/* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 
*/
+#define LXCFS_NUMSTRLEN64 21
+
 /* Define pivot_root() if missing from the C library */
 #ifndef HAVE_PIVOT_ROOT
 static int pivot_root(const char * new_root, const char * put_old)
@@ -3454,25 +3461,152 @@
        return rv;
 }
 
-static long int getreaperctime(pid_t pid)
+static uint64_t get_reaper_start_time(pid_t pid)
 {
-       char fnam[100];
-       struct stat sb;
        int ret;
+       FILE *f;
+       uint64_t starttime;
+       /* strlen("/proc/") = 6
+        * +
+        * LXCFS_NUMSTRLEN64
+        * +
+        * strlen("/stat") = 5
+        * +
+        * \0 = 1
+        * */
+#define __PROC_PID_STAT_LEN (6 + LXCFS_NUMSTRLEN64 + 5 + 1)
+       char path[__PROC_PID_STAT_LEN];
        pid_t qpid;
 
        qpid = lookup_initpid_in_store(pid);
-       if (qpid <= 0)
+       if (qpid <= 0) {
+               /* Caller can check for EINVAL on 0. */
+               errno = EINVAL;
                return 0;
+       }
 
-       ret = snprintf(fnam, 100, "/proc/%d", qpid);
-       if (ret < 0 || ret >= 100)
+       ret = snprintf(path, __PROC_PID_STAT_LEN, "/proc/%d/stat", qpid);
+       if (ret < 0 || ret >= __PROC_PID_STAT_LEN) {
+               /* Caller can check for EINVAL on 0. */
+               errno = EINVAL;
+               return 0;
+       }
+
+       f = fopen(path, "r");
+       if (!f) {
+               /* Caller can check for EINVAL on 0. */
+               errno = EINVAL;
+               return 0;
+       }
+
+       /* Note that the *scanf() argument supression requires that length
+        * modifiers such as "l" are omitted. Otherwise some compilers will yell
+        * at us. It's like telling someone you're not married and then asking
+        * if you can bring your wife to the party.
+        */
+       ret = fscanf(f, "%*d "      /* (1)  pid         %d   */
+                       "%*s "      /* (2)  comm        %s   */
+                       "%*c "      /* (3)  state       %c   */
+                       "%*d "      /* (4)  ppid        %d   */
+                       "%*d "      /* (5)  pgrp        %d   */
+                       "%*d "      /* (6)  session     %d   */
+                       "%*d "      /* (7)  tty_nr      %d   */
+                       "%*d "      /* (8)  tpgid       %d   */
+                       "%*u "      /* (9)  flags       %u   */
+                       "%*u "      /* (10) minflt      %lu  */
+                       "%*u "      /* (11) cminflt     %lu  */
+                       "%*u "      /* (12) majflt      %lu  */
+                       "%*u "      /* (13) cmajflt     %lu  */
+                       "%*u "      /* (14) utime       %lu  */
+                       "%*u "      /* (15) stime       %lu  */
+                       "%*d "      /* (16) cutime      %ld  */
+                       "%*d "      /* (17) cstime      %ld  */
+                       "%*d "      /* (18) priority    %ld  */
+                       "%*d "      /* (19) nice        %ld  */
+                       "%*d "      /* (20) num_threads %ld  */
+                       "%*d "      /* (21) itrealvalue %ld  */
+                       "%" PRIu64, /* (22) starttime   %llu */
+                    &starttime);
+       if (ret != 1) {
+               fclose(f);
+               /* Caller can check for EINVAL on 0. */
+               errno = EINVAL;
                return 0;
+       }
+
+       fclose(f);
+
+       errno = 0;
+       return starttime;
+}
+
+static uint64_t get_reaper_start_time_in_sec(pid_t pid)
+{
+       uint64_t clockticks;
+       int64_t ticks_per_sec;
+
+       clockticks = get_reaper_start_time(pid);
+       if (clockticks == 0 && errno == EINVAL) {
+               lxcfs_debug("failed to retrieve start time of pid %d\n", pid);
+               return 0;
+       }
+
+       ticks_per_sec = sysconf(_SC_CLK_TCK);
+       if (ticks_per_sec < 0 && errno == EINVAL) {
+               lxcfs_debug(
+                   "%s\n",
+                   "failed to determine number of clock ticks in a second");
+               return 0;
+       }
+
+       return (clockticks /= ticks_per_sec);
+}
 
-       if (lstat(fnam, &sb) < 0)
+static uint64_t get_reaper_age(pid_t pid)
+{
+       uint64_t procstart, uptime, procage;
+
+       /* We need to substract the time the process has started since system
+        * boot minus the time when the system has started to get the actual
+        * reaper age.
+        */
+       procstart = get_reaper_start_time_in_sec(pid);
+       procage = procstart;
+       if (procstart > 0) {
+               int ret;
+               struct timespec spec;
+
+               ret = clock_gettime(CLOCK_BOOTTIME, &spec);
+               if (ret < 0)
+                       return 0;
+               /* We could make this more precise here by using the tv_nsec
+                * field in the timespec struct and convert it to milliseconds
+                * and then create a double for the seconds and milliseconds but
+                * that seems more work than it is worth.
+                */
+               uptime = spec.tv_sec;
+               procage = uptime - procstart;
+       }
+
+       return procage;
+}
+
+static uint64_t get_reaper_btime(pid)
+{
+       int ret;
+       struct sysinfo sys;
+       uint64_t procstart;
+       uint64_t uptime;
+
+       ret = sysinfo(&sys);
+       if (ret < 0) {
+               lxcfs_debug("%s\n", "failed to retrieve system information");
                return 0;
+       }
 
-       return sb.st_ctime;
+       uptime = (uint64_t)time(NULL) - (uint64_t)sys.uptime;
+       procstart = get_reaper_start_time_in_sec(pid);
+       return uptime + procstart;
 }
 
 #define CPUALL_MAX_SIZE (BUF_RESERVE_SIZE / 2)
@@ -3538,10 +3672,7 @@
                        continue;
                if (sscanf(line, "cpu%9[^ ]", cpu_char) != 1) {
                        /* not a ^cpuN line containing a number N, just print 
it */
-                       if (strncmp(line, "btime", 5) == 0)
-                               l = snprintf(cache, cache_size, "btime %ld\n", 
getreaperctime(fc->pid));
-                       else
-                               l = snprintf(cache, cache_size, "%s", line);
+                       l = snprintf(cache, cache_size, "%s", line);
                        if (l < 0) {
                                perror("Error writing to cache");
                                rv = 0;
@@ -3649,16 +3780,13 @@
        return rv;
 }
 
-static long int getreaperage(pid_t pid)
-{
-       long int ctime;
-
-       ctime = getreaperctime(pid);
-       if (ctime)
-               return time(NULL) - ctime;
-       return ctime;
-}
-
+/* This function retrieves the busy time of a group of tasks by looking at
+ * cpuacct.usage. Unfortunately, this only makes sense when the container has
+ * been given it's own cpuacct cgroup. If not, this function will take the busy
+ * time of all other taks that do not actually belong to the container into
+ * account as well. If someone has a clever solution for this please send a
+ * patch!
+ */
 static unsigned long get_reaper_busy(pid_t task)
 {
        pid_t initpid = lookup_initpid_in_store(task);
@@ -3704,33 +3832,37 @@
 {
        struct fuse_context *fc = fuse_get_context();
        struct file_info *d = (struct file_info *)fi->fh;
-       long int reaperage = getreaperage(fc->pid);
-       unsigned long int busytime = get_reaper_busy(fc->pid), idletime;
+       unsigned long int busytime = get_reaper_busy(fc->pid);
        char *cache = d->buf;
        ssize_t total_len = 0;
+       uint64_t idletime, reaperage;
 
 #if RELOADTEST
        iwashere();
 #endif
 
        if (offset){
-               if (offset > d->size)
-                       return -EINVAL;
                if (!d->cached)
                        return 0;
+               if (offset > d->size)
+                       return -EINVAL;
                int left = d->size - offset;
                total_len = left > size ? size: left;
                memcpy(buf, cache + offset, total_len);
                return total_len;
        }
 
-       idletime = reaperage - busytime;
-       if (idletime > reaperage)
-               idletime = reaperage;
-
-       total_len = snprintf(d->buf, d->size, "%ld.0 %lu.0\n", reaperage, 
idletime);
-       if (total_len < 0){
-               perror("Error writing to cache");
+       reaperage = get_reaper_age(fc->pid);
+       /* To understand why this is done, please read the comment to the
+        * get_reaper_busy() function.
+        */
+       idletime = reaperage;
+       if (reaperage >= busytime)
+               idletime = reaperage - busytime;
+
+       total_len = snprintf(d->buf, d->buflen, "%"PRIu64".00 %"PRIu64".00\n", 
reaperage, idletime);
+       if (total_len < 0 || total_len >=  d->buflen){
+               lxcfs_error("%s\n", "failed to write to cache");
                return 0;
        }
 
@@ -4383,11 +4515,13 @@
 
        for (i = 0; i < num_hierarchies; i++) {
                char *controller = hierarchies[i];
+
                clen = strlen(controller);
                len = strlen(BASEDIR) + clen + 2;
                target = malloc(len);
                if (!target)
                        return false;
+
                ret = snprintf(target, len, "%s/%s", BASEDIR, controller);
                if (ret < 0 || ret >= len) {
                        free(target);
@@ -4397,8 +4531,12 @@
                        free(target);
                        return false;
                }
-               if (mount(controller, target, "cgroup", 0, controller) < 0) {
-                       lxcfs_error("Failed mounting cgroup %s\n", controller);
+               if (!strcmp(controller, "unified"))
+                       ret = mount("none", target, "cgroup2", 0, NULL);
+               else
+                       ret = mount(controller, target, "cgroup", 0, 
controller);
+               if (ret < 0) {
+                       lxcfs_error("Failed mounting cgroup %s: %s\n", 
controller, strerror(errno));
                        free(target);
                        return false;
                }
@@ -4449,6 +4587,7 @@
        char cwd[MAXPATHLEN];
        size_t len = 0;
        int i, init_ns = -1;
+       bool found_unified = false;
 
        if ((f = fopen("/proc/self/cgroup", "r")) == NULL) {
                lxcfs_error("Error opening /proc/self/cgroup: %s\n", 
strerror(errno));
@@ -4456,11 +4595,12 @@
        }
 
        while (getline(&line, &len, f) != -1) {
-               char *p, *p2;
+               char *idx, *p, *p2;
 
                p = strchr(line, ':');
                if (!p)
                        goto out;
+               idx = line;
                *(p++) = '\0';
 
                p2 = strrchr(p, ':');
@@ -4473,8 +4613,10 @@
                 * because it parses out the empty string "" and later on passes
                 * it to mount(). Let's skip such entries.
                 */
-               if (!strcmp(p, ""))
-                       continue;
+               if (!strcmp(p, "") && !strcmp(idx, "0") && !found_unified) {
+                       found_unified = true;
+                       p = "unified";
+               }
 
                if (!store_hierarchy(line, p))
                        goto out;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/Makefile.in 
new/lxcfs-2.0.8/config/Makefile.in
--- old/lxcfs-2.0.7/config/Makefile.in  2017-05-11 19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/config/Makefile.in  2017-10-19 19:06:46.000000000 +0200
@@ -294,6 +294,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/init/Makefile.in 
new/lxcfs-2.0.8/config/init/Makefile.in
--- old/lxcfs-2.0.7/config/init/Makefile.in     2017-05-11 19:01:59.000000000 
+0200
+++ new/lxcfs-2.0.8/config/init/Makefile.in     2017-10-19 19:06:46.000000000 
+0200
@@ -294,6 +294,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/init/systemd/Makefile.in 
new/lxcfs-2.0.8/config/init/systemd/Makefile.in
--- old/lxcfs-2.0.7/config/init/systemd/Makefile.in     2017-05-11 
19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/config/init/systemd/Makefile.in     2017-10-19 
19:06:46.000000000 +0200
@@ -234,6 +234,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -362,8 +363,8 @@
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@INIT_SCRIPT_SYSTEMD_FALSE@uninstall-local:
 @INIT_SCRIPT_SYSTEMD_FALSE@install-data-local:
+@INIT_SCRIPT_SYSTEMD_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool mostlyclean-am
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/init/sysvinit/Makefile.in 
new/lxcfs-2.0.8/config/init/sysvinit/Makefile.in
--- old/lxcfs-2.0.7/config/init/sysvinit/Makefile.in    2017-05-11 
19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/config/init/sysvinit/Makefile.in    2017-10-19 
19:06:47.000000000 +0200
@@ -234,6 +234,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -361,8 +362,8 @@
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@INIT_SCRIPT_SYSV_FALSE@install-data-local:
 @INIT_SCRIPT_SYSV_FALSE@uninstall-local:
+@INIT_SCRIPT_SYSV_FALSE@install-data-local:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool mostlyclean-am
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/init/sysvinit/lxcfs 
new/lxcfs-2.0.8/config/init/sysvinit/lxcfs
--- old/lxcfs-2.0.7/config/init/sysvinit/lxcfs  2017-05-11 19:01:42.000000000 
+0200
+++ new/lxcfs-2.0.8/config/init/sysvinit/lxcfs  2017-10-19 19:06:41.000000000 
+0200
@@ -6,6 +6,8 @@
 # Provides:             lxcfs
 # Required-Start:       $remote_fs
 # Required-Stop:        $remote_fs
+# Should-Start:         cgroupfs-mount
+# Should-Stop:          cgroupfs-mount
 # Default-Start:        2 3 4 5
 # Default-Stop:         0 1 6
 ### END INIT INFO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/config/init/upstart/Makefile.in 
new/lxcfs-2.0.8/config/init/upstart/Makefile.in
--- old/lxcfs-2.0.7/config/init/upstart/Makefile.in     2017-05-11 
19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/config/init/upstart/Makefile.in     2017-10-19 
19:06:47.000000000 +0200
@@ -234,6 +234,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/configure new/lxcfs-2.0.8/configure
--- old/lxcfs-2.0.7/configure   2017-05-11 19:01:58.000000000 +0200
+++ new/lxcfs-2.0.8/configure   2017-10-19 19:06:46.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for lxcfs 2.0.7.
+# Generated by GNU Autoconf 2.69 for lxcfs 2.0.8.
 #
 # Report bugs to <[email protected]>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='lxcfs'
 PACKAGE_TARNAME='lxcfs'
-PACKAGE_VERSION='2.0.7'
-PACKAGE_STRING='lxcfs 2.0.7'
+PACKAGE_VERSION='2.0.8'
+PACKAGE_STRING='lxcfs 2.0.8'
 PACKAGE_BUGREPORT='[email protected]'
 PACKAGE_URL=''
 
@@ -641,6 +641,7 @@
 PAM_CFLAGS
 HAVE_PAM_FALSE
 HAVE_PAM_TRUE
+lxcfsdir
 INIT_SCRIPT_UPSTART_FALSE
 INIT_SCRIPT_UPSTART_TRUE
 INIT_SCRIPT_SYSTEMD_FALSE
@@ -1368,7 +1369,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures lxcfs 2.0.7 to adapt to many kinds of systems.
+\`configure' configures lxcfs 2.0.8 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1439,7 +1440,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of lxcfs 2.0.7:";;
+     short | recursive ) echo "Configuration of lxcfs 2.0.8:";;
    esac
   cat <<\_ACEOF
 
@@ -1569,7 +1570,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-lxcfs configure 2.0.7
+lxcfs configure 2.0.8
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1938,7 +1939,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by lxcfs $as_me 2.0.7, which was
+It was created by lxcfs $as_me 2.0.8, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2805,7 +2806,7 @@
 
 # Define the identity of the package.
  PACKAGE='lxcfs'
- VERSION='2.0.7'
+ VERSION='2.0.8'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13835,6 +13836,8 @@
 $as_echo "$init_script" >&6; }
 
 
+lxcfsdir="${libdir}/lxcfs"
+
 
 # Check whether --with-pamdir was given.
 if test "${with_pamdir+set}" = set; then :
@@ -14519,7 +14522,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by lxcfs $as_me 2.0.7, which was
+This file was extended by lxcfs $as_me 2.0.8, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14585,7 +14588,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-lxcfs config.status 2.0.7
+lxcfs config.status 2.0.8
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/configure.ac new/lxcfs-2.0.8/configure.ac
--- old/lxcfs-2.0.7/configure.ac        2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/configure.ac        2017-10-19 19:06:41.000000000 +0200
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([lxcfs], [2.0.7], [[email protected]])
+AC_INIT([lxcfs], [2.0.8], [[email protected]])
 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -151,6 +151,7 @@
 AC_MSG_RESULT($init_script)
 
 
+AC_SUBST([lxcfsdir], "${libdir}/lxcfs")
 AC_ARG_WITH(
        [pamdir],
        [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM 
modules are stored,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/lxcfs.c new/lxcfs-2.0.8/lxcfs.c
--- old/lxcfs-2.0.7/lxcfs.c     2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/lxcfs.c     2017-10-19 19:06:41.000000000 +0200
@@ -28,6 +28,7 @@
 #include <sys/epoll.h>
 #include <sys/mount.h>
 #include <sys/socket.h>
+#include <linux/limits.h>
 
 #include "bindings.h"
 #include "config.h" // for VERSION
@@ -74,6 +75,7 @@
  * lock and when we know the user_count was 0 */
 static void do_reload(void)
 {
+       char lxcfs_lib_path[PATH_MAX];
        if (dlopen_handle) {
                lxcfs_debug("%s\n", "Closing liblxcfs.so handle.");
                dlclose(dlopen_handle);
@@ -86,7 +88,13 @@
                goto good;
        }
 
-       dlopen_handle = dlopen("/usr/lib/lxcfs/liblxcfs.so", RTLD_LAZY);
+#ifdef LIBDIR
+       /* LIBDIR: autoconf will setup this MACRO. Default value is $PREFIX/lib 
*/
+        snprintf(lxcfs_lib_path, PATH_MAX, "%s/lxcfs/liblxcfs.so", LIBDIR);
+#else
+        snprintf(lxcfs_lib_path, PATH_MAX, "/usr/local/lib/lxcfs/liblxcfs.so");
+#endif
+        dlopen_handle = dlopen(lxcfs_lib_path, RTLD_LAZY);
        if (!dlopen_handle) {
                lxcfs_error("Failed to open liblxcfs.so: %s.\n", dlerror());
                _exit(1);
@@ -737,7 +745,8 @@
 {
        fprintf(stderr, "Usage:\n");
        fprintf(stderr, "\n");
-       fprintf(stderr, "lxcfs [-p pidfile] mountpoint\n");
+       fprintf(stderr, "lxcfs [-f|-d] [-p pidfile] mountpoint\n");
+       fprintf(stderr, "  -f running foreground by default; -d enable debug 
output \n");
        fprintf(stderr, "  Default pidfile is %s/lxcfs.pid\n", RUNTIME_PATH);
        fprintf(stderr, "lxcfs -h\n");
        exit(1);
@@ -753,7 +762,7 @@
        return false;
 }
 
-void swallow_arg(int *argcp, char *argv[], char *which)
+bool swallow_arg(int *argcp, char *argv[], char *which)
 {
        int i;
 
@@ -764,8 +773,9 @@
                        argv[i] = argv[i+1];
                }
                (*argcp)--;
-               return;
+               return true;
        }
+       return false;
 }
 
 bool swallow_option(int *argcp, char *argv[], char *opt, char **v)
@@ -837,9 +847,10 @@
        int pidfd = -1;
        char *pidfile = NULL, *v = NULL;
        size_t pidfile_len;
+       bool debug = false;
        /*
         * what we pass to fuse_main is:
-        * argv[0] -s -f -o allow_other,directio argv[1] NULL
+        * argv[0] -s [-f|-d] -o allow_other,directio argv[1] NULL
         */
        int nargs = 5, cnt = 0;
        char *newargv[6];
@@ -847,6 +858,7 @@
        /* accomodate older init scripts */
        swallow_arg(&argc, argv, "-s");
        swallow_arg(&argc, argv, "-f");
+       debug = swallow_arg(&argc, argv, "-d");
        if (swallow_option(&argc, argv, "-o", &v)) {
                if (strcmp(v, "allow_other") != 0) {
                        fprintf(stderr, "Warning: unexpected fuse option %s\n", 
v);
@@ -872,7 +884,11 @@
        }
 
        newargv[cnt++] = argv[0];
-       newargv[cnt++] = "-f";
+        if (debug) {
+                newargv[cnt++] = "-d";
+        } else {
+                newargv[cnt++] = "-f";
+        }
        newargv[cnt++] = "-o";
        newargv[cnt++] = 
"allow_other,direct_io,entry_timeout=0.5,attr_timeout=0.5";
        newargv[cnt++] = argv[1];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/pam/pam_cgfs.c 
new/lxcfs-2.0.8/pam/pam_cgfs.c
--- old/lxcfs-2.0.7/pam/pam_cgfs.c      2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/pam/pam_cgfs.c      2017-10-19 19:06:41.000000000 +0200
@@ -140,7 +140,7 @@
 static ssize_t cg_get_max_cpus(char *cpulist);
 static int cg_get_version_of_mntpt(const char *path);
 static bool cg_init(uid_t uid, gid_t gid);
-static void cg_mark_to_make_rw(const char *cstring);
+static void cg_mark_to_make_rw(char **list);
 static void cg_prune_empty_cgroups(const char *user);
 static bool cg_systemd_created_user_slice(const char *base_cgroup,
                                          const char *init_cgroup,
@@ -418,6 +418,39 @@
        return false;
 }
 
+/*
+ * Creates a null-terminated array of strings, made by splitting the entries in
+ * @str on each @sep. Caller is responsible for calling free_string_list.
+ */
+static char **make_string_list(const char *str, const char *sep)
+{
+       char *copy, *tok;
+       char *saveptr = NULL;
+       char **clist = NULL;
+
+       copy = must_copy_string(str);
+
+       for (tok = strtok_r(copy, sep, &saveptr); tok;
+            tok = strtok_r(NULL, sep, &saveptr))
+               must_add_to_list(&clist, tok);
+
+       free(copy);
+
+       return clist;
+}
+
+/* Gets the length of a null-terminated array of strings. */
+static size_t string_list_length(char **list)
+{
+       size_t len = 0;
+       char **it;
+
+       for (it = list; it && *it; it++)
+               len++;
+
+       return len;
+}
+
 /* Free null-terminated array of strings. */
 static void free_string_list(char **list)
 {
@@ -761,7 +794,8 @@
 
        for (it = cgv1_hierarchies; it && *it; it++)
                if ((*it)->controllers)
-                       if (cgv1_controller_lists_intersect((*it)->controllers, 
clist))
+                       if (cgv1_controller_lists_intersect((*it)->controllers, 
clist) ||
+                               string_in_list(clist, "all"))
                                (*it)->create_rw_cgroup = true;
 }
 
@@ -770,30 +804,16 @@
  */
 static void cgv2_mark_to_make_rw(char **clist)
 {
-       if (string_in_list(clist, "unified"))
+       if (string_in_list(clist, "unified") || string_in_list(clist, "all"))
                if (cgv2_hierarchies)
                        (*cgv2_hierarchies)->create_rw_cgroup = true;
 }
 
 /* Wrapper around cgv{1,2}_mark_to_make_rw(). */
-static void cg_mark_to_make_rw(const char *cstring)
+static void cg_mark_to_make_rw(char **clist)
 {
-       char *copy, *tok;
-       char *saveptr = NULL;
-       char **clist = NULL;
-
-       copy = must_copy_string(cstring);
-
-       for (tok = strtok_r(copy, ",", &saveptr); tok;
-            tok = strtok_r(NULL, ",", &saveptr))
-               must_add_to_list(&clist, tok);
-
-       free(copy);
-
        cgv1_mark_to_make_rw(clist);
        cgv2_mark_to_make_rw(clist);
-
-       free_string_list(clist);
 }
 
 /* Prefix any named controllers with "name=", e.g. "name=systemd". */
@@ -1389,6 +1409,7 @@
                 * each of those mountpoints will expose identical information.
                 * So let the first mountpoint we find, win.
                 */
+               ret = true;
                break;
        }
 
@@ -1511,8 +1532,7 @@
        if (!v2->create_rw_cgroup || v2->systemd_user_slice)
                return true;
 
-       path = must_make_path(v2->mountpoint, v2->base_cgroup, cgroup,
-                             "/cgroup.procs", NULL);
+       path = must_make_path(v2->mountpoint, v2->base_cgroup, cgroup, 
"/cgroup.procs", NULL);
        lxcfs_debug("Attempting to enter cgroupfs v2 hierarchy in cgroup 
\"%s\".\n", path);
        entered = write_int(path, (int)getpid());
        if (!entered) {
@@ -2250,7 +2270,7 @@
        char *clean_base_cgroup;
        char *path;
        struct cgv2_hierarchy *v2;
-       bool created = false;
+       bool our_cg = false, created = false;
 
        *existed = false;
 
@@ -2262,12 +2282,11 @@
        /* We can't be placed under init's cgroup for the v2 hierarchy. We need
         * to be placed under our current cgroup.
         */
-       if (cg_systemd_chown_existing_cgroup(v2->mountpoint,
-                               v2->base_cgroup, uid, gid,
-                               v2->systemd_user_slice))
-               return true;
+       if (cg_systemd_chown_existing_cgroup(v2->mountpoint, v2->base_cgroup,
+                                            uid, gid, v2->systemd_user_slice))
+               goto chown_cgroup_procs_file;
 
-       /* We need to make sure that we do not create an endless chaing of
+       /* We need to make sure that we do not create an endless chain of
         * sub-cgroups. So we check if we have already logged in somehow (sudo
         * -i, su, etc.) and have created a /user/PAM_user/idx cgroup. If so, we
         * skip that part.
@@ -2284,14 +2303,18 @@
        path = must_make_path(v2->mountpoint, v2->base_cgroup, cgroup, NULL);
        lxcfs_debug("Constructing path \"%s\".\n", path);
        if (file_exists(path)) {
-               bool our_cg = cg_belongs_to_uid_gid(path, uid, gid);
-               lxcfs_debug("%s existed and does %shave our uid: %d and gid: 
%d.\n", path, our_cg ? "" : "not ", uid, gid);
+               our_cg = cg_belongs_to_uid_gid(path, uid, gid);
+               lxcfs_debug(
+                   "%s existed and does %shave our uid: %d and gid: %d.\n",
+                   path, our_cg ? "" : "not ", uid, gid);
                free(path);
-               if (our_cg)
+               if (our_cg) {
                        *existed = false;
-               else
+                       goto chown_cgroup_procs_file;
+               } else {
                        *existed = true;
-               return our_cg;
+                       return false;
+               }
        }
 
        created = mkdir_p(v2->mountpoint, path);
@@ -2300,10 +2323,27 @@
                return false;
        }
 
+       /* chown cgroup to user */
        if (chown(path, uid, gid) < 0)
                mysyslog(LOG_WARNING, "Failed to chown %s to %d:%d: %s.\n",
                         path, (int)uid, (int)gid, strerror(errno), NULL);
-       lxcfs_debug("Chowned %s to %d:%d.\n", path, (int)uid, (int)gid);
+       else
+               lxcfs_debug("Chowned %s to %d:%d.\n", path, (int)uid, (int)gid);
+       free(path);
+
+chown_cgroup_procs_file:
+       /* chown cgroup.procs to user */
+       if (v2->systemd_user_slice)
+               path = must_make_path(v2->mountpoint, v2->base_cgroup,
+                                     "/cgroup.procs", NULL);
+       else
+               path = must_make_path(v2->mountpoint, v2->base_cgroup, cgroup,
+                                     "/cgroup.procs", NULL);
+       if (chown(path, uid, gid) < 0)
+               mysyslog(LOG_WARNING, "Failed to chown %s to %d:%d: %s.\n",
+                        path, (int)uid, (int)gid, strerror(errno), NULL);
+       else
+               lxcfs_debug("Chowned %s to %d:%d.\n", path, (int)uid, (int)gid);
        free(path);
 
        return true;
@@ -2547,8 +2587,22 @@
        if (cg_mount_mode == CGROUP_UNKNOWN)
                return PAM_SESSION_ERR;
 
-       if (argc > 1 && strcmp(argv[0], "-c") == 0)
-               cg_mark_to_make_rw(argv[1]);
+       if (argc > 1 && !strcmp(argv[0], "-c")) {
+               char **clist = make_string_list(argv[1], ",");
+
+               /*
+                * We don't allow using "all" and other controllers explicitly 
because
+                * that simply doesn't make any sense.
+                */
+               if (string_list_length(clist) > 1 && string_in_list(clist, 
"all")) {
+                       mysyslog(LOG_ERR, "Invalid -c option, cannot specify 
individual controllers alongside 'all'.\n", NULL);
+                       free_string_list(clist);
+                       return PAM_SESSION_ERR;
+               }
+
+               cg_mark_to_make_rw(clist);
+               free_string_list(clist);
+       }
 
        return handle_login(PAM_user, uid, gid);
 }
@@ -2576,8 +2630,22 @@
                if (!cg_init(uid, gid))
                        mysyslog(LOG_ERR, "Failed to get list of 
controllers\n", NULL);
 
-               if (argc > 1 && strcmp(argv[0], "-c") == 0)
-                       cg_mark_to_make_rw(argv[1]);
+               if (argc > 1 && !strcmp(argv[0], "-c")) {
+                       char **clist = make_string_list(argv[1], ",");
+
+                       /*
+                        * We don't allow using "all" and other controllers 
explicitly because
+                        * that simply doesn't make any sense.
+                        */
+                       if (string_list_length(clist) > 1 && 
string_in_list(clist, "all")) {
+                               mysyslog(LOG_ERR, "Invalid -c option, cannot 
specify individual controllers alongside 'all'.\n", NULL);
+                               free_string_list(clist);
+                               return PAM_SESSION_ERR;
+                       }
+
+                       cg_mark_to_make_rw(clist);
+                       free_string_list(clist);
+               }
        }
 
        cg_prune_empty_cgroups(PAM_user);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/share/Makefile.in 
new/lxcfs-2.0.8/share/Makefile.in
--- old/lxcfs-2.0.7/share/Makefile.in   2017-05-11 19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/share/Makefile.in   2017-10-19 19:06:47.000000000 +0200
@@ -268,6 +268,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/tests/Makefile.in 
new/lxcfs-2.0.8/tests/Makefile.in
--- old/lxcfs-2.0.7/tests/Makefile.in   2017-05-11 19:01:59.000000000 +0200
+++ new/lxcfs-2.0.8/tests/Makefile.in   2017-10-19 19:06:47.000000000 +0200
@@ -234,6 +234,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lxcfsdir = @lxcfsdir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lxcfs-2.0.7/tests/test_proc 
new/lxcfs-2.0.8/tests/test_proc
--- old/lxcfs-2.0.7/tests/test_proc     2017-05-11 19:01:42.000000000 +0200
+++ new/lxcfs-2.0.8/tests/test_proc     2017-10-19 19:06:41.000000000 +0200
@@ -36,7 +36,7 @@
 echo 0 > ${cpupath}/lxcfs_test_proc/cpuset.cpus
 
 # Test uptime
-[ "$(cat ${LXCFSDIR}/proc/uptime)" = "0.0 0.0" ]
+[ "$(cat ${LXCFSDIR}/proc/uptime)" = "0.00 0.00" ]
 
 # Test cpuinfo
 [ "$(grep "^processor" ${LXCFSDIR}/proc/cpuinfo | wc -l)" = "1" ]


Reply via email to