Package: systemd
Version: 215-17+deb8u2
Severity: critical
Tags: patch
Justification: breaks unrelated software

If you use cgroups, then systemd will on occasions destroy your
settings. To reproduce:
 - Set up cgroups e.g. adding TaskIDs to /sys/fs/cgroup/cpu/DIR/tasks
   files. (I use cgrulesengd from package cgroup-tools, but any other
   use of cgroups is equally affected.)
 - Then when you use systemd commands:
     systemctl daemon-reload
     systemctl start anacron
   you will see your cgroups (your tasks files) becoming empty.
   Command daemon-reload seems to happen within "apt-get dist-upgrade"
   sequences, and "start anacron" happens nightly. (Some other systemd
   commands may also affect.)

I propose the attached patch to avoid the issue. This patch seems to work
well for me.

Cheers, Paul

Paul Szabo   p...@maths.usyd.edu.au   http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics   University of Sydney    Australia


-- Package-specific info:

-- System Information:
Debian Release: 8.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (x86_64)

Kernel: Linux 3.16.7-ckt11-pk07.12-amd64 (SMP w/8 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages systemd depends on:
ii  acl             2.2.52-2
ii  adduser         3.113+nmu3
ii  initscripts     2.88dsf-59
ii  libacl1         2.2.52-2
ii  libaudit1       1:2.4-1+b1
ii  libblkid1       2.25.2-6
ii  libc6           2.19-18+deb8u1
ii  libcap2         1:2.24-8
ii  libcap2-bin     1:2.24-8
ii  libcryptsetup4  2:1.6.6-5
ii  libgcrypt20     1.6.3-2
ii  libkmod2        18-3
ii  liblzma5        5.1.1alpha+20120614-2+b3
ii  libpam0g        1.1.8-3.1
ii  libselinux1     2.3-2
ii  libsystemd0     215-17+deb8u2
ii  mount           2.25.2-6
ii  sysv-rc         2.88dsf-59
ii  udev            215-17+deb8u2
ii  util-linux      2.25.2-6

Versions of packages systemd recommends:
ii  dbus            1.8.20-0+deb8u1
ii  libpam-systemd  215-17+deb8u2

Versions of packages systemd suggests:
pn  systemd-ui  <none>

-- no debconf information
diff -r -U12 a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
--- a/src/shared/cgroup-util.c	2015-10-25 07:16:24.000000000 +1100
+++ b/src/shared/cgroup-util.c	2015-10-26 06:03:25.000000000 +1100
@@ -281,24 +281,34 @@
 
 int cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char *pto, bool ignore_self) {
         bool done = false;
         _cleanup_set_free_ Set *s = NULL;
         int r, ret = 0;
         pid_t my_pid;
 
         assert(cfrom);
         assert(pfrom);
         assert(cto);
         assert(pto);
 
+        /*
+         * PSz 25 Oct 2015
+         * An empty "to" path is surely wrong (do not annoy cgroups that not ours)
+         */
+        if (!strlen(pto)) {
+                /* log_warning("Debug: cg_migrate skip from (%s)%s to (%s)%s", cfrom, pfrom, cto, pto); */
+                return ret;
+        }
+        /* log_warning("Debug: cg_migrate do from (%s)%s to (%s)%s", cfrom, pfrom, cto, pto); */
+
         s = set_new(trivial_hash_func, trivial_compare_func);
         if (!s)
                 return -ENOMEM;
 
         my_pid = getpid();
 
         do {
                 _cleanup_fclose_ FILE *f = NULL;
                 pid_t pid = 0;
                 done = true;
 
                 r = cg_enumerate_processes(cfrom, pfrom, &f);

Reply via email to