On 2015-02-24 at 22:57 +0300, Ivan Shapovalov wrote:
> Because the order of coldplugging is not defined, we can reference a
> not-yet-coldplugged unit and read its state while it has not yet been
> set to a meaningful value.
> 
> This way, already active units may get started again.
> 
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88401
> ---
> 
> I'm unsure whether I've done all this correctly. At least it seems that there
> are no leaks, and it survives the "while :; do systemctl daemon-reload & done"
> test.
> 
>  [...]

And here is a "reproducer" patch.
It makes all *.path units coldplugged before anything else.
You need to have at least one *.path unit started and "running"
(so that it will try to start the triggering unit immediately
during coldplug, and the bug will manifest itself).

The patch is against the unfixed tree. It conflicts with the actual fix,
but well...

diff --git a/src/core/manager.c b/src/core/manager.c
index 6382400..b5c4ed8 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -980,6 +980,26 @@ static int manager_coldplug(Manager *m) {
                 if (u->id != k)
                         continue;
 
+                /* we need a reproducer */
+                if (!endswith(u->id, ".path"))
+                        continue;
+
+                q = unit_coldplug(u);
+                if (q < 0)
+                        r = q;
+        }
+
+        HASHMAP_FOREACH_KEY(u, k, m->units, i) {
+                int q;
+
+                /* ignore aliases */
+                if (u->id != k)
+                        continue;
+
+                /* already processed them */
+                if (endswith(u->id, ".path"))
+                        continue;
+
                 q = unit_coldplug(u);
                 if (q < 0)
                         r = q;

-- 
Ivan Shapovalov / intelfx /

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to