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

Florian Weimer fweimer@redhat.com
Mon Sep 7 15:55:01 GMT 2026


* 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.

Thanks,
Florian



More information about the Libc-alpha mailing list