[PATCH] elf: Do not load cache extensions from an old-format ld.so.cache [BZ #34600]

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Sep 8 20:41:04 GMT 2026



On 07/09/26 12:55, Florian Weimer wrote:
> * Shamil Abdulaev:
> 
>> diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
>> index 972ab32b86..b1de245438 100644
>> --- a/sysdeps/generic/dl-cache.h
>> +++ b/sysdeps/generic/dl-cache.h
>> @@ -321,6 +321,9 @@ cache_extension_load (const struct cache_file_new *cache,
>>  		      struct cache_extension_all_loaded *loaded)
>>  {
>>    memset (loaded, 0, sizeof (*loaded));
>> +  if (cache == NULL)
>> +    /* Old-format cache without a new-format header, so no extensions.  */
>> +    return true;
>>    if (cache->extension_offset == 0)
>>      /* No extensions present.  This is not a format error.  */
>>      return true;
> 
> Fix looks reasonable.  It could be placed in the caller, too, but
> locating it here is okay as well.
> 
> The test looks reasonable.  The duplication of the magic numbers could
> be avoided by making the test tests-internal, but this approach here
> seems acceptable.  (We want some sort of alert if these constants
> change …)
> 
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
> 
> I'm going to push this later.
I think it would be worth to backport to 2.44 as well.


More information about the Libc-alpha mailing list