public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] syslog: Improve fortify with clang
@ 2024-02-07 14:03 Adhemerval Zanella
  0 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-02-07 14:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e3e14dce80be367b83adaf64352693e4482444a6

commit e3e14dce80be367b83adaf64352693e4482444a6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Dec 5 10:40:06 2023 -0300

    syslog: Improve fortify with clang
    
    It improve fortify checks for syslog and vsyslog.  The compile
    and runtime hecks have similar coverage as with GCC.
    
    The syslog fortify wrapper calls the va_arg version, since clang does
    not support __va_arg_pack.
    
    Checked on aarch64, armhf, x86_64, and i686.

Diff:
---
 misc/bits/syslog.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index aadcd42000..100b0c78cc 100644
--- a/misc/bits/syslog.h
+++ b/misc/bits/syslog.h
@@ -36,6 +36,15 @@ syslog (int __pri, const char *__fmt, ...)
 {
   __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 }
+#elif __fortify_use_clang && defined __USE_MISC
+__fortify_function_error_function __attribute_overloadable__ void
+syslog (int __pri, __fortify_clang_overload_arg (const char *, , __fmt), ...)
+{
+  __gnuc_va_list __fortify_ap;
+  __builtin_va_start (__fortify_ap, __fmt);
+  __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __fortify_ap);
+  __builtin_va_end (__fortify_ap);
+}
 #elif !defined __cplusplus
 # define syslog(pri, ...) \
   __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
@@ -43,8 +52,9 @@ syslog (int __pri, const char *__fmt, ...)
 
 
 #ifdef __USE_MISC
-__fortify_function void
-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+__fortify_function __attribute_overloadable__ void
+vsyslog (int __pri, __fortify_clang_overload_arg (const char *, ,__fmt),
+	 __gnuc_va_list __ap)
 {
   __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }

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

* [glibc/azanella/clang] syslog: Improve fortify with clang
@ 2024-02-09 17:28 Adhemerval Zanella
  0 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-02-09 17:28 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e4f4ac378722ecd5b334537671ac77f207d18538

commit e4f4ac378722ecd5b334537671ac77f207d18538
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Dec 5 10:40:06 2023 -0300

    syslog: Improve fortify with clang
    
    It improve fortify checks for syslog and vsyslog.  The compile
    and runtime hecks have similar coverage as with GCC.
    
    The syslog fortify wrapper calls the va_arg version, since clang does
    not support __va_arg_pack.
    
    Checked on aarch64, armhf, x86_64, and i686.

Diff:
---
 misc/bits/syslog.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index aadcd42000..100b0c78cc 100644
--- a/misc/bits/syslog.h
+++ b/misc/bits/syslog.h
@@ -36,6 +36,15 @@ syslog (int __pri, const char *__fmt, ...)
 {
   __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 }
+#elif __fortify_use_clang && defined __USE_MISC
+__fortify_function_error_function __attribute_overloadable__ void
+syslog (int __pri, __fortify_clang_overload_arg (const char *, , __fmt), ...)
+{
+  __gnuc_va_list __fortify_ap;
+  __builtin_va_start (__fortify_ap, __fmt);
+  __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __fortify_ap);
+  __builtin_va_end (__fortify_ap);
+}
 #elif !defined __cplusplus
 # define syslog(pri, ...) \
   __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
@@ -43,8 +52,9 @@ syslog (int __pri, const char *__fmt, ...)
 
 
 #ifdef __USE_MISC
-__fortify_function void
-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+__fortify_function __attribute_overloadable__ void
+vsyslog (int __pri, __fortify_clang_overload_arg (const char *, ,__fmt),
+	 __gnuc_va_list __ap)
 {
   __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }

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

* [glibc/azanella/clang] syslog: Improve fortify with clang
@ 2024-01-29 17:53 Adhemerval Zanella
  0 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-01-29 17:53 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0b648bd88e511202d44a829b2e12b8d3ebb590ff

commit 0b648bd88e511202d44a829b2e12b8d3ebb590ff
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Dec 5 10:40:06 2023 -0300

    syslog: Improve fortify with clang
    
    It improve fortify checks for syslog and vsyslog.  The compile
    and runtime hecks have similar coverage as with GCC.
    
    The syslog fortify wrapper calls the va_arg version, since clang does
    not support __va_arg_pack.
    
    Checked on aarch64, armhf, x86_64, and i686.

Diff:
---
 misc/bits/syslog.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index aadcd42000..100b0c78cc 100644
--- a/misc/bits/syslog.h
+++ b/misc/bits/syslog.h
@@ -36,6 +36,15 @@ syslog (int __pri, const char *__fmt, ...)
 {
   __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 }
+#elif __fortify_use_clang && defined __USE_MISC
+__fortify_function_error_function __attribute_overloadable__ void
+syslog (int __pri, __fortify_clang_overload_arg (const char *, , __fmt), ...)
+{
+  __gnuc_va_list __fortify_ap;
+  __builtin_va_start (__fortify_ap, __fmt);
+  __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __fortify_ap);
+  __builtin_va_end (__fortify_ap);
+}
 #elif !defined __cplusplus
 # define syslog(pri, ...) \
   __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
@@ -43,8 +52,9 @@ syslog (int __pri, const char *__fmt, ...)
 
 
 #ifdef __USE_MISC
-__fortify_function void
-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+__fortify_function __attribute_overloadable__ void
+vsyslog (int __pri, __fortify_clang_overload_arg (const char *, ,__fmt),
+	 __gnuc_va_list __ap)
 {
   __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }

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

* [glibc/azanella/clang] syslog: Improve fortify with clang
@ 2023-12-21 18:50 Adhemerval Zanella
  0 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2023-12-21 18:50 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2c3f0b6815a1c7846f930980085f25275b14c386

commit 2c3f0b6815a1c7846f930980085f25275b14c386
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Dec 5 10:40:06 2023 -0300

    syslog: Improve fortify with clang
    
    It improve fortify checks for syslog and vsyslog.  The compile
    and runtime hecks have similar coverage as with GCC.
    
    The syslog fortify wrapper calls the va_arg version, since clang does
    not support __va_arg_pack.
    
    Checked on aarch64, armhf, x86_64, and i686.

Diff:
---
 misc/bits/syslog.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index d7de90ed14..969ce9e431 100644
--- a/misc/bits/syslog.h
+++ b/misc/bits/syslog.h
@@ -36,6 +36,15 @@ syslog (int __pri, const char *__fmt, ...)
 {
   __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 }
+#elif __fortify_use_clang && defined __USE_MISC
+__fortify_function_error_function __attribute_overloadable__ void
+syslog (int __pri, __fortify_clang_overload_arg (const char *, , __fmt), ...)
+{
+  __gnuc_va_list __fortify_ap;
+  __builtin_va_start (__fortify_ap, __fmt);
+  __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __fortify_ap);
+  __builtin_va_end (__fortify_ap);
+}
 #elif !defined __cplusplus
 # define syslog(pri, ...) \
   __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
@@ -43,8 +52,9 @@ syslog (int __pri, const char *__fmt, ...)
 
 
 #ifdef __USE_MISC
-__fortify_function void
-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+__fortify_function __attribute_overloadable__ void
+vsyslog (int __pri, __fortify_clang_overload_arg (const char *, ,__fmt),
+	 __gnuc_va_list __ap)
 {
   __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }

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

end of thread, other threads:[~2024-02-09 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 14:03 [glibc/azanella/clang] syslog: Improve fortify with clang Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2024-02-09 17:28 Adhemerval Zanella
2024-01-29 17:53 Adhemerval Zanella
2023-12-21 18:50 Adhemerval Zanella

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