Sync with upstream branch release/2.34/master

Upstream commit: a4217408a3d6050a7f42ac23adb6ac7218dca85f

- Apply asm redirections in syslog.h before first use [BZ #27087]
- _Static_assert needs two arguments for compatibility with GCC before 9

Resolves: #2142974
Related: #2149102
Related: #2142935 (actually fixed in fb3d49c3bf)
This commit is contained in:
Arjun Shankar 2022-12-07 15:09:04 +01:00
parent fb3d49c3bf
commit 1bc41d2121
3 changed files with 110 additions and 1 deletions

View File

@ -0,0 +1,29 @@
commit a1c12fdf3f9b8665719835ce8330b3b2e2574b37
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 10 13:18:36 2021 +0200
_Static_assert needs two arguments for compatibility with GCC before 9
This macro definition enforces two arguments even with newer compilers
that accept the single-argument form, too.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit c9fef4b7d1d0f2dad192c74f06102752247677a9)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6a76160ed4e4cabb..56adb231aa8f8cbe 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -1,5 +1,12 @@
#ifndef _SYS_CDEFS_H
+/* This is outside of _ISOMAC to enforce that _Static_assert always
+ uses the two-argument form. This can be removed once the minimum
+ GCC version used to compile glibc is GCC 9.1. */
+#ifndef __cplusplus
+# define _Static_assert(expr, diagnostic) _Static_assert (expr, diagnostic)
+#endif
+
#include <misc/sys/cdefs.h>
#ifndef _ISOMAC

View File

@ -0,0 +1,72 @@
commit a4217408a3d6050a7f42ac23adb6ac7218dca85f
Author: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Date: Fri Nov 11 17:00:15 2022 -0300
Apply asm redirections in syslog.h before first use [BZ #27087]
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.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 227df6243a2b5b4d70d11772d12c02eb9cb666ca)
diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
index 6f3137a98ee593f3..10c9c1151382a51c 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 dc3b0e7ef81de812..e7a98fb9b13ce132 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

View File

@ -148,7 +148,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 52%{?dist}
Release: 53%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -668,6 +668,8 @@ Patch443: glibc-upstream-2.34-363.patch
Patch444: glibc-upstream-2.34-364.patch
Patch445: glibc-upstream-2.34-365.patch
Patch446: glibc-rh2149102.patch
Patch447: glibc-upstream-2.34-366.patch
Patch448: glibc-upstream-2.34-367.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2793,6 +2795,12 @@ fi
%endif
%changelog
* Wed Dec 07 2022 Arjun Shankar <arjun@redhat.com> - 2.34-53
- Sync with upstream branch release/2.34/master,
commit a4217408a3d6050a7f42ac23adb6ac7218dca85f:
- Apply asm redirections in syslog.h before first use [BZ #27087]
- _Static_assert needs two arguments for compatibility with GCC before 9
* Wed Nov 30 2022 Florian Weimer <fweimer@redhat.com> - 2.34-52
- Add noarch sysroot subpackages (#2149644)