Bug#918764: udev: "udevadm control --reload-rules" kills all processes except init

Felipe Sateler fsateler at debian.org
Wed Jan 30 21:02:02 GMT 2019


On Tue, Jan 29, 2019 at 9:39 PM Axel Beckert <abe at debian.org> wrote:

>
> Then I uninstalled not all of them at once but each of them one by
> one. And the one after whose purging
>
> # service udev restart
> # udevadm control --reload-rules
>
> didn't kill my processes anymore was cgroupfs-mount.
>
> So for some reason this killing only seems to happen on my box if
> cgroupfs-mount is installed. Then again, this is only necessary if
> systemd is not installed.


Thanks everyone for the detailed debugging. This appears to be the culprit:
udev tries to detect if running under systemd, and if so will kill its
entire cgroup (to cleanup leftover processes). Looks like cgroupfs-mount is
fooling udev into thinking it is running under systemd.

Could someone attach gdb to udev, break on the function `on_post`, trigger
the bug, and report what does `manager->cgroup` contain?



> But we also had reports where this happend
> with systemd, so this doesn't seem to be depend on the init system (at
> most at the init system's default features) and hence also the package
> cgroupfs-mount can't be held guilty for this.
>

Can you point me at one? (sorry, I'm late to this bug and currently ENOTIME
to read the entire backlog). It seems this should not happen on systemd
systems, because systemd properly isolates udev to its own cgroup when
starting.


>
> Which IMHO again leaves either src:systemd or src:linux as rc-buggy
> package.
>

I think something like this might be sufficient to work around the bug in
sysvinit systems:

% git diff
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index fb8724ea87..a03b65a773 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1814,7 +1814,7 @@ static int run(int argc, char *argv[]) {

         dev_setup(NULL, UID_INVALID, GID_INVALID);

-        if (getppid() == 1) {
+        if (getppid() == 1 && sd_booted()) {
                 /* get our own cgroup, we regularly kill everything udev
has left behind
                    we only do this on systemd systems, and only if we are
directly spawned
                    by PID1. otherwise we are not guaranteed to have a
dedicated cgroup */


-- 

Saludos,
Felipe Sateler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20190130/51a6bda4/attachment.html>


More information about the Pkg-systemd-maintainers mailing list