[Bug debuginfod/28240] debuginfod client cache falsely sticky for root user

mark at klomp dot org sourceware-bugzilla@sourceware.org
Mon Oct 25 12:35:37 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=28240

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
So this makes most uses for the user "root" correct, but still contains a race
condition:

+        /* TOCTOU non-problem: if another task races, puts a working
+           download or a 000 file in its place, unlinking here just
+           means WE will try to download again as uncached. */
         unlink(target_cache_path);
     }
+  
+  /* If the target is already in the cache (known not-000 - PR28240), 
+     then we are done. */
+  int fd = open (target_cache_path, O_RDONLY);
+  if (fd >= 0)
+    {
+      /* Success!!!! */
+      if (path != NULL)
+        *path = strdup(target_cache_path);
+      rc = fd;
+      goto out;
+    }

The problem isn't when WE try to download and/or (re)set the 000 file. The
problem is if someone other client races past us after the unlink and puts a
000 file back (because the server still doesn't have it). Then the open will
again succeed for us, but the target is 000.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list