]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/killall: correctly warn about rootfs daemon's root
authorMike Yuan <me@yhndnzj.com>
Sat, 2 Dec 2023 07:23:51 +0000 (15:23 +0800)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 6 Dec 2023 21:03:35 +0000 (22:03 +0100)
Follow-up for 9e615117dab5ede72eec22bf6369e0138f9dace5

We'll typically send signals to all remaining processes in the following
cases:

1. pid1 (in initrd) when transitioning from initrd to sysroot: SIGTERM
2. pid1 (in sysroot) before transitioning back to initrd (exitrd): SIGTERM + SIGKILL
3. systemd-shutdown (in exitrd): SIGTERM + SIGKILL

'warn_rootfs' is set to true only when we're not in initrd and we're
sending SIGKILL, which means the second case. So, we want to emit the
warning when the root of the storage daemon IS the same as that of pid1,
rather than the other way around.

The condition is spuriously reversed in the offending commit.

src/shared/killall.c

index 9c2babe7d28cd4cdc165b68e00f65682ddce55f9..330b4c3272d779a7da498ed85c8a175998a712fb 100644 (file)
@@ -101,7 +101,7 @@ static bool ignore_proc(const PidRef *pid, bool warn_rootfs) {
                 return false;
 
         if (warn_rootfs &&
-            pid_from_same_root_fs(pid->pid) == 0) {
+            pid_from_same_root_fs(pid->pid) > 0) {
 
                 _cleanup_free_ char *comm = NULL;