[PATCH v5 2/4] Add system-wide tunables: cache ld.so.cache
Yury Khrustalev
yury.khrustalev@arm.com
Wed Feb 25 14:24:51 GMT 2026
On Mon, Feb 23, 2026 at 08:21:19PM -0500, DJ Delorie wrote:
>
> Yury Khrustalev <yury.khrustalev@arm.com> writes:
> > This is such an extensive change. Is the existing functionality covered
> > with any tests?
>
> It's the dynamic loader. Every program in the testsuite is a test ;-)
Not every program uses all features of ld.so.cache and config though.
If this patch breaks some corner case that is not covered by any of the
tests, we would have introduced a regression.
My question was about how good is test coverage of this code with the
existing tests? I suppose most use one or two most straightforward
situations which is implemented by a small chunk of this code?
> ...
>
> >> _dl_unload_cache (void)
> >> {
> >> - if (cache != NULL && cache != (struct cache_file *) -1)
> >> - {
> >> - __munmap (cache, cachesize);
> >> - cache = NULL;
> >> - }
> >> -#ifdef SHARED
> >> - /* This marks the glibc_hwcaps_priorities array as out-of-date. */
> >> - glibc_hwcaps_priorities_length = 0;
> >> -#endif
> >> + /* Functionality is no longer needed, but kept for internal ABI for
> >> + now. */
> >
> > This seems really suspicious. This is used in 2 places and presumably
> > some effect is expected from calling this function and now nothing will
> > happen?
>
> The whole point of caching the data is to, well, cache the data. It's
> not freed unless it's being replaced by data from a known-good cache
> file. This was requested by Carlos, so I'll defer to him to justify it.
> IIRC at least part of the reason was to ensure that dlopen() had valid
> cache data to work with, even if the file is corrupted while the program
> was running.
Hmm, sorry, I don't follow. Previously memory was unmapped when this
function was called and cache was reset and now none of that happens.
I'm not asking why we needed to clear cache from some places, I'm saying
that now we no longer do this. If it's supposed to somehow happen behind
the scenes, then we should just remove calls to this function and leave
a comment explaining what actually happens to unloading cache.
More information about the Libc-alpha
mailing list