From: Frank Ch. Eigler Date: Wed, 8 Dec 2021 15:20:58 +0000 (-0500) Subject: debuginfod: correct concurrency bug in fdcache metrics X-Git-Tag: elfutils-0.187~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8349d63903ce20f15ab78150d150822b1883098b;p=thirdparty%2Felfutils.git debuginfod: correct concurrency bug in fdcache metrics The intern() function called set_metrics() outside a necessary lock being held. helgrind identified this race condition. No QA impact. Signed-off-by: Frank Ch. Eigler --- diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 8c937d662..8cbaa9aa6 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,7 @@ +2021-12-08 Frank Ch. Eigler + + * debuginfod.cxx (intern): Call set_metrics() holding the fdcache mutex. + 2021-12-04 Mark Wielaard * debuginfod-client.c (debuginfod_query_server): Free winning_headers. diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 0d3f02978..a26e7e8fc 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1354,8 +1354,8 @@ public: if (verbose > 3) obatched(clog) << "fdcache interned a=" << a << " b=" << b << " fd=" << fd << " mb=" << mb << " front=" << front_p << endl; + set_metrics(); } - set_metrics(); // NB: we age the cache at lookup time too if (statfs_free_enough_p(tmpdir, "tmpdir", fdcache_mintmp))