diff mbox series

string: Disable stack protector for memset in early static initialization

Message ID 20240122134520.3381928-1-adhemerval.zanella@linaro.org
State New
Headers show
Series string: Disable stack protector for memset in early static initialization | expand

Commit Message

Adhemerval Zanella Netto Jan. 22, 2024, 1:45 p.m. UTC
For ports that use the default memset, the compiler might generic early
calls before the stack protector is initialized (for instance, riscv
with -fstack-protector-all on _dl_aux_init).

Checked on riscv64-linux-gnu-rv64imafdc-lp64d.
---
 string/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Florian Weimer Jan. 22, 2024, 1:51 p.m. UTC | #1
* Adhemerval Zanella:

> For ports that use the default memset, the compiler might generic early
> calls before the stack protector is initialized (for instance, riscv
> with -fstack-protector-all on _dl_aux_init).
>
> Checked on riscv64-linux-gnu-rv64imafdc-lp64d.
> ---
>  string/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/string/Makefile b/string/Makefile
> index 3ba77e1b2f..8f31fa49e6 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -270,6 +270,7 @@ CFLAGS-memcpy.c += $(no-stack-protector)
>  CFLAGS-wordcopy.c += $(no-stack-protector)
>  # Called during static initialization
>  CFLAGS-strncmp.c += $(no-stack-protector)
> +CFLAGS-memset.c += $(no-stack-protector)
>  
>  CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes)
>  CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes)

Looks okay to me, thanks.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Florian
Andreas Schwab Jan. 22, 2024, 1:56 p.m. UTC | #2
On Jan 22 2024, Adhemerval Zanella wrote:

> For ports that use the default memset, the compiler might generic early

s/generic/generate/
diff mbox series

Patch

diff --git a/string/Makefile b/string/Makefile
index 3ba77e1b2f..8f31fa49e6 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -270,6 +270,7 @@  CFLAGS-memcpy.c += $(no-stack-protector)
 CFLAGS-wordcopy.c += $(no-stack-protector)
 # Called during static initialization
 CFLAGS-strncmp.c += $(no-stack-protector)
+CFLAGS-memset.c += $(no-stack-protector)
 
 CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes)
 CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes)