public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] string: Add hidden builtin definition for __strcpy_chk.
@ 2024-02-05 13:22 Stefan Liebler
  2024-02-05 18:12 ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Liebler @ 2024-02-05 13:22 UTC (permalink / raw)
  To: libc-alpha; +Cc: Stefan Liebler

Otherwise on at least x86_64 and s390x there is an unwanted PLT entry
in libc.so when configured with --enable-fortify-source and build
with -Os.

This is observed in elf/check-localplt
Extra PLT reference: libc.so: __strcpy_chk

The call to PLT entry is in inet/ruserpass.c.
---
 debug/strcpy_chk.c | 1 +
 include/string.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/debug/strcpy_chk.c b/debug/strcpy_chk.c
index e54780ddde..dd2c453417 100644
--- a/debug/strcpy_chk.c
+++ b/debug/strcpy_chk.c
@@ -31,3 +31,4 @@ __strcpy_chk (char *dest, const char *src, size_t destlen)
 
   return memcpy (dest, src, len + 1);
 }
+libc_hidden_builtin_def (__strcpy_chk)
diff --git a/include/string.h b/include/string.h
index 86d1fa4abe..3b4c6007d7 100644
--- a/include/string.h
+++ b/include/string.h
@@ -215,6 +215,7 @@ libc_hidden_builtin_proto (__mempcpy_chk)
 libc_hidden_builtin_proto (__memset_chk)
 libc_hidden_builtin_proto (__stpcpy_chk)
 libc_hidden_builtin_proto (__strncpy_chk)
+libc_hidden_builtin_proto (__strcpy_chk)
 
 #endif
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] string: Add hidden builtin definition for __strcpy_chk.
  2024-02-05 13:22 [PATCH] string: Add hidden builtin definition for __strcpy_chk Stefan Liebler
@ 2024-02-05 18:12 ` Adhemerval Zanella Netto
  2024-02-06  8:19   ` Stefan Liebler
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2024-02-05 18:12 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha



On 05/02/24 10:22, Stefan Liebler wrote:
> Otherwise on at least x86_64 and s390x there is an unwanted PLT entry
> in libc.so when configured with --enable-fortify-source and build
> with -Os.

I think it would be useful to add that it also requires --enable-fortify-source=3
to trigger it.

> 
> This is observed in elf/check-localplt
> Extra PLT reference: libc.so: __strcpy_chk
> 
> The call to PLT entry is in inet/ruserpass.c.

LGTM, thanks.

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

> ---
>  debug/strcpy_chk.c | 1 +
>  include/string.h   | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/debug/strcpy_chk.c b/debug/strcpy_chk.c
> index e54780ddde..dd2c453417 100644
> --- a/debug/strcpy_chk.c
> +++ b/debug/strcpy_chk.c
> @@ -31,3 +31,4 @@ __strcpy_chk (char *dest, const char *src, size_t destlen)
>  
>    return memcpy (dest, src, len + 1);
>  }
> +libc_hidden_builtin_def (__strcpy_chk)
> diff --git a/include/string.h b/include/string.h
> index 86d1fa4abe..3b4c6007d7 100644
> --- a/include/string.h
> +++ b/include/string.h
> @@ -215,6 +215,7 @@ libc_hidden_builtin_proto (__mempcpy_chk)
>  libc_hidden_builtin_proto (__memset_chk)
>  libc_hidden_builtin_proto (__stpcpy_chk)
>  libc_hidden_builtin_proto (__strncpy_chk)
> +libc_hidden_builtin_proto (__strcpy_chk)
>  
>  #endif
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] string: Add hidden builtin definition for __strcpy_chk.
  2024-02-05 18:12 ` Adhemerval Zanella Netto
@ 2024-02-06  8:19   ` Stefan Liebler
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Liebler @ 2024-02-06  8:19 UTC (permalink / raw)
  To: Adhemerval Zanella Netto, libc-alpha

On 05.02.24 19:12, Adhemerval Zanella Netto wrote:
> 
> 
> On 05/02/24 10:22, Stefan Liebler wrote:
>> Otherwise on at least x86_64 and s390x there is an unwanted PLT entry
>> in libc.so when configured with --enable-fortify-source and build
>> with -Os.
> 
> I think it would be useful to add that it also requires --enable-fortify-source=3
> to trigger it.
I've double checked with my builds. For me it is also level 3. I've
adjusted it in the commit message.
> 
>>
>> This is observed in elf/check-localplt
>> Extra PLT reference: libc.so: __strcpy_chk
>>
>> The call to PLT entry is in inet/ruserpass.c.
> 
> LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 
Thanks for reviewing. I've just committed the patch


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-06  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 13:22 [PATCH] string: Add hidden builtin definition for __strcpy_chk Stefan Liebler
2024-02-05 18:12 ` Adhemerval Zanella Netto
2024-02-06  8:19   ` Stefan Liebler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).