[PATCH v2] AArch64: Avoid memset ifunc in cpu-features.c [BZ #33112]

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Fri Jun 27 17:25:36 GMT 2025



On 27/06/25 11:20, Wilco Dijkstra wrote:
> v2: Use dl-symbol-redir-ifunc.h to avoid ifuncs in startup code
> 
> During early startup memcpy or memset must not be called since many targets
> use ifuncs for them which won't be initialized yet.  Security hardening may
> use -ftrivial-auto-var-init=zero which inserts calls to memset.  Redirect
> memset to memset_generic by including dl-symbol-redir-ifunc.h in cpu-features.c.
> This fixes BZ #33112.
> 
> Tested ldconfig doesn't crash with -ftrivial-auto-var-init=zero. OK for commit?

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> 
> ---
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> index 6d63c8a9ecba5608ebd96c6ac2455778f5fbee3c..1acc82d07720541340705141f498cd09b8e51e7c 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> @@ -23,6 +23,7 @@
>  #include <sys/prctl.h>
>  #include <sys/utsname.h>
>  #include <dl-tunables-parse.h>
> +#include <dl-symbol-redir-ifunc.h>
>  
>  #define DCZID_DZP_MASK (1 << 4)
>  #define DCZID_BS_MASK (0xf)
> 



More information about the Libc-alpha mailing list