]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Fix glibc-hwcaps priorities with cache flags mismatches [BZ #27046]
authorFlorian Weimer <fweimer@redhat.com>
Fri, 25 Jun 2021 06:02:30 +0000 (08:02 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 18 Jan 2022 22:10:25 +0000 (23:10 +0100)
commitac148bdd88403b66faf71466dc999c4f4b6dea0a
treeaefde2d837207e465e18a1bbd7bc752375dd4fd9
parent5cab4e3f3a623d2c9ad7cd64e4dde48095aa2383
elf: Fix glibc-hwcaps priorities with cache flags mismatches [BZ #27046]

If lib->flags (in the cache) did not match GLRO (dl_correct_cache_id),
searching for further glibc-hwcaps entries did not happen, and it
was possible that the best glibc-hwcaps was not found.  By accident,
this causes a test failure for elf/tst-glibc-hwcaps-prepend-cache
on armv7l.

This commit changes the cache lookup logic to continue searching
if (a) no match has been found, (b) a named glibc-hwcaps match
has been found(), or (c) non-glibc-hwcaps match has been found
and the entry flags and cache default flags do not match.

_DL_CACHE_DEFAULT_ID is used instead of GLRO (dl_correct_cache_id)
because the latter is only written once on i386 if loading
of libc.so.5 libraries is selected, so GLRO (dl_correct_cache_id)
should probably removed in a future change.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit 66db95b6e8264c5a6307f6a9e5285fec76907254)
elf/dl-cache.c