[PATCH v5 3/4] Add system-wide tunables: Apply tunables part

Yury Khrustalev yury.khrustalev@arm.com
Tue Feb 17 14:44:16 GMT 2026


On Wed, Feb 21, 2024 at 06:49:50PM -0500, DJ Delorie wrote:
> 
> Load ld.so.cache and fetch the tunables extension.  Apply
> those tunables to the current program.  We do not yet apply
> security policies.

By "security policies" do you mean "filtering" or something else?

> diff --git a/elf/Makefile b/elf/Makefile
> index 42da891f5a..282af88e71 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -91,6 +91,7 @@ dl-routines = \
>  
>  ifeq (yes,$(use-ldconfig))
>  dl-routines += dl-cache
> +CFLAGS-dl-tunables.c += -DUSE_LDCONFIG

Shouldn't this be already present in the flags? At least it works without
this line.

> ...
>
> --- a/elf/dl-cache.c
> +++ b/elf/dl-cache.c
> @@ -29,6 +29,7 @@
>
> ...
>
> +
> +const struct tunable_header_cached *
> +_dl_load_cache_tunables (const char **data)
> +{
> +  struct cache_extension_all_loaded ext;
> +
> +  /* This loads the cache (temporary).  */
> +  if (_dl_check_ldsocache_needs_loading ())
> +    _dl_maybe_load_ldsocache ();
> +
> +  if (cache_new && cache_new != (void *) -1)

Can cache_new ever be (void *) -1? Do you mean MAP_FAILED?

> ...
>
> diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
> index 37ade374c6..83808f75e7 100644
> --- a/elf/dl-tunables.c
> +++ b/elf/dl-tunables.c

This seems OK but it needs some good tests to check what happens if the
tunables in the config file mismatch tunables supported by this Glibc.

> ...
>
> +	      else
> +		{
> +		  tunable_initialize (& tunable_list[tid],
> +				      value, strlen (value));
> +		}
> +	    }
> +	}
> +    }
> +#endif

Nit: probably add

  // #if defined(SHARED) && defined (USE_LDCONFIG)

after this #endif since the code block is quite long?

> ...
>
> diff --git a/elf/tunconf.h b/elf/tunconf.h
> index a6c5f0dd9a..623fb7546d 100644
> --- a/elf/tunconf.h
> +++ b/elf/tunconf.h

OK



More information about the Libc-alpha mailing list