* [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087]
@ 2022-11-16 15:08 Tulio Magno Quites Machado Filho via Libc-alpha
2022-11-17 18:32 ` Adhemerval Zanella Netto via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: Tulio Magno Quites Machado Filho via Libc-alpha @ 2022-11-16 15:08 UTC (permalink / raw)
To: libc-alpha; +Cc: carlos
From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Similar to d0fa09a770, but for syslog.h when _FORTIFY_SOURCE > 0.
Fixes [BZ #27087] by applying long double-related asm redirections
before using functions in bits/syslog.h.
Tested with build-many-glibcs.py.
---
misc/bits/syslog.h | 18 ++++++++++++++----
misc/sys/syslog.h | 10 +++++-----
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index fd30dd3114..916d2b6f12 100644
--- a/misc/bits/syslog.h
+++ b/misc/bits/syslog.h
@@ -24,6 +24,20 @@
extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
+#ifdef __USE_MISC
+extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
+ __gnuc_va_list __ap)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
+#endif
+
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# include <bits/syslog-ldbl.h>
+#endif
+
+/* The following functions must be used only after applying all asm
+ redirections, e.g. long double asm redirections. */
+
#ifdef __va_arg_pack
__fortify_function void
syslog (int __pri, const char *__fmt, ...)
@@ -37,10 +51,6 @@ syslog (int __pri, const char *__fmt, ...)
#ifdef __USE_MISC
-extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
- __gnuc_va_list __ap)
- __attribute__ ((__format__ (__printf__, 3, 0)));
-
__fortify_function void
vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
{
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index d933fea104..3888153ed2 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -205,11 +205,11 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
/* Define some macros helping to catch buffer overflows. */
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/syslog.h>
-#endif
-
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/syslog-ldbl.h>
+#else
+# include <bits/floatn.h>
+# if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# include <bits/syslog-ldbl.h>
+# endif
#endif
__END_DECLS
--
2.37.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087]
2022-11-16 15:08 [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087] Tulio Magno Quites Machado Filho via Libc-alpha
@ 2022-11-17 18:32 ` Adhemerval Zanella Netto via Libc-alpha
2022-11-29 14:13 ` Carlos O'Donell via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: Adhemerval Zanella Netto via Libc-alpha @ 2022-11-17 18:32 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho, libc-alpha; +Cc: carlos
On 16/11/22 12:08, Tulio Magno Quites Machado Filho via Libc-alpha wrote:
> From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
>
> Similar to d0fa09a770, but for syslog.h when _FORTIFY_SOURCE > 0.
> Fixes [BZ #27087] by applying long double-related asm redirections
> before using functions in bits/syslog.h.
>
> Tested with build-many-glibcs.py.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> misc/bits/syslog.h | 18 ++++++++++++++----
> misc/sys/syslog.h | 10 +++++-----
> 2 files changed, 19 insertions(+), 9 deletions(-)
>
> diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
> index fd30dd3114..916d2b6f12 100644
> --- a/misc/bits/syslog.h
> +++ b/misc/bits/syslog.h
> @@ -24,6 +24,20 @@
> extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...)
> __attribute__ ((__format__ (__printf__, 3, 4)));
>
> +#ifdef __USE_MISC
> +extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
> + __gnuc_va_list __ap)
> + __attribute__ ((__format__ (__printf__, 3, 0)));
> +#endif
> +
> +#include <bits/floatn.h>
> +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
> +# include <bits/syslog-ldbl.h>
> +#endif
> +
> +/* The following functions must be used only after applying all asm
> + redirections, e.g. long double asm redirections. */
> +
> #ifdef __va_arg_pack
> __fortify_function void
> syslog (int __pri, const char *__fmt, ...)
> @@ -37,10 +51,6 @@ syslog (int __pri, const char *__fmt, ...)
>
>
> #ifdef __USE_MISC
> -extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
> - __gnuc_va_list __ap)
> - __attribute__ ((__format__ (__printf__, 3, 0)));
> -
> __fortify_function void
> vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
> {
> diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
> index d933fea104..3888153ed2 100644
> --- a/misc/sys/syslog.h
> +++ b/misc/sys/syslog.h
> @@ -205,11 +205,11 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
> /* Define some macros helping to catch buffer overflows. */
> #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
> # include <bits/syslog.h>
> -#endif
> -
> -#include <bits/floatn.h>
> -#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
> -# include <bits/syslog-ldbl.h>
> +#else
> +# include <bits/floatn.h>
> +# if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
> +# include <bits/syslog-ldbl.h>
> +# endif
> #endif
>
> __END_DECLS
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087]
2022-11-17 18:32 ` Adhemerval Zanella Netto via Libc-alpha
@ 2022-11-29 14:13 ` Carlos O'Donell via Libc-alpha
2022-11-29 20:00 ` Tulio Magno Quites Machado Filho via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-11-29 14:13 UTC (permalink / raw)
To: Adhemerval Zanella Netto, Tulio Magno Quites Machado Filho,
libc-alpha
On 11/17/22 13:32, Adhemerval Zanella Netto wrote:
>
>
> On 16/11/22 12:08, Tulio Magno Quites Machado Filho via Libc-alpha wrote:
>> From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
>>
>> Similar to d0fa09a770, but for syslog.h when _FORTIFY_SOURCE > 0.
>> Fixes [BZ #27087] by applying long double-related asm redirections
>> before using functions in bits/syslog.h.
>>
>> Tested with build-many-glibcs.py.
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Tulio,
May you please kindly push this so we can fix the build issues?
--
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087]
2022-11-29 14:13 ` Carlos O'Donell via Libc-alpha
@ 2022-11-29 20:00 ` Tulio Magno Quites Machado Filho via Libc-alpha
0 siblings, 0 replies; 4+ messages in thread
From: Tulio Magno Quites Machado Filho via Libc-alpha @ 2022-11-29 20:00 UTC (permalink / raw)
To: Carlos O'Donell, Adhemerval Zanella Netto, libc-alpha
Carlos O'Donell <carlos@redhat.com> writes:
> On 11/17/22 13:32, Adhemerval Zanella Netto wrote:
>
> May you please kindly push this so we can fix the build issues?
Pushed as 227df6243a2b5b4d70d11772d12c02eb9cb666ca.
I also plan to backport this fix to 2.34, 2.35 and 2.36.
Thank you!
--
Tulio Magno
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-29 20:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 15:08 [PATCH] Apply asm redirections in syslog.h before first use [BZ #27087] Tulio Magno Quites Machado Filho via Libc-alpha
2022-11-17 18:32 ` Adhemerval Zanella Netto via Libc-alpha
2022-11-29 14:13 ` Carlos O'Donell via Libc-alpha
2022-11-29 20:00 ` Tulio Magno Quites Machado Filho via Libc-alpha
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).