From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 879043858C27; Mon, 25 Oct 2021 12:35:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 879043858C27 From: "mark at klomp dot org" To: elfutils-devel@sourceware.org Subject: [Bug debuginfod/28240] debuginfod client cache falsely sticky for root user Date: Mon, 25 Oct 2021 12:35:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: debuginfod X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2021 12:35:37 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28240 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at klomp dot org Resolution|FIXED |--- Status|RESOLVED |REOPENED --- Comment #2 from Mark Wielaard --- So this makes most uses for the user "root" correct, but still contains a r= ace 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); } +=20=20 + /* If the target is already in the cache (known not-000 - PR28240),=20 + then we are done. */ + int fd =3D open (target_cache_path, O_RDONLY); + if (fd >=3D 0) + { + /* Success!!!! */ + if (path !=3D NULL) + *path =3D strdup(target_cache_path); + rc =3D 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=