From: "Frédéric Bérat" <fberat@redhat.com>
To: libc-alpha@sourceware.org
Cc: siddhesh@gotplt.org, fberat@redhat.com
Subject: [PATCH 09/21] asprintf_chk: Ensure compatibility for both s390x and ppc64le
Date: Tue, 20 Jun 2023 20:18:57 +0200 [thread overview]
Message-ID: <20230620181910.1506893-10-fberat@redhat.com> (raw)
In-Reply-To: <20230620181910.1506893-1-fberat@redhat.com>
If ldbl_* macros are used for asprintf, ABI gets broken on s390x,
if it isn't, ppc64le isn't building due to multiple asm redirections.
This is due to the inclusion of bits/stdio-lbdl.h for ppc64le whereas it
isn't for s390x. This header creates redirections, which are not
compatible with the ones generated using libc_hidden_builtin_def.
Yet, we can't use libc_hidden_ldbl_proto on s390x since it will not
create a simple strong alias (e.g. as done on x86_64), but a versioned
alias, leading to ABI breakage.
---
debug/asprintf_chk.c | 12 ++++++++++++
include/stdio.h | 5 +++++
2 files changed, 17 insertions(+)
diff --git a/debug/asprintf_chk.c b/debug/asprintf_chk.c
index 06d112de00..7da1cddacb 100644
--- a/debug/asprintf_chk.c
+++ b/debug/asprintf_chk.c
@@ -36,5 +36,17 @@ ___asprintf_chk (char **result_ptr, int flag, const char *format, ...)
return ret;
}
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+/* This is needed since <bits/stdio-lbdl.h> is included in this case, leading to
+ * multiple asm redirection of the same symbol
+ */
ldbl_hidden_def (___asprintf_chk, __asprintf_chk)
ldbl_strong_alias (___asprintf_chk, __asprintf_chk)
+#else
+/* Yet, we can't use ldbl_* macros on some systems, even if they don't fall in
+ * the first case as this leads to ABI breakage due to the long_double_symbol
+ * aliasing, which is versionned.
+ */
+strong_alias (___asprintf_chk, __asprintf_chk)
+libc_hidden_builtin_def (__asprintf_chk)
+#endif
diff --git a/include/stdio.h b/include/stdio.h
index 3afb0ff77b..6755877911 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -279,7 +279,12 @@ rtld_hidden_proto (__libc_fatal)
libc_hidden_proto (__fgets_unlocked_chk)
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
libc_hidden_ldbl_proto (__asprintf_chk)
+#else
+libc_hidden_proto (__asprintf_chk)
+#endif
+
libc_hidden_ldbl_proto (__fprintf_chk)
libc_hidden_ldbl_proto (__sprintf_chk)
libc_hidden_ldbl_proto (__vsprintf_chk)
--
2.41.0
next prev parent reply other threads:[~2023-06-20 18:19 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 18:18 [PATCH 00/21] Allow glibc to be built with _FORTIFY_SOURCE Frédéric Bérat
2023-06-20 18:18 ` [PATCH 01/21] Add --enable-fortify-source option Frédéric Bérat
2023-06-20 20:42 ` Joseph Myers
2023-06-21 13:19 ` Frederic Berat
2023-06-21 13:18 ` Frederic Berat
2023-06-21 15:25 ` Siddhesh Poyarekar
2023-06-22 11:48 ` Frederic Berat
2023-06-22 11:54 ` Siddhesh Poyarekar
2023-06-22 12:29 ` Adhemerval Zanella Netto
2023-06-22 12:50 ` Siddhesh Poyarekar
2023-06-22 19:39 ` Adhemerval Zanella Netto
2023-06-22 21:26 ` Siddhesh Poyarekar
2023-06-23 7:29 ` Frederic Berat
2023-06-23 5:46 ` Sam James
2023-06-20 18:18 ` [PATCH 02/21] Configure: regenerate for autoconf 2.71 Frédéric Bérat
2023-06-20 20:47 ` Joseph Myers
2023-06-22 19:07 ` Florian Weimer
2023-06-23 11:28 ` Carlos O'Donell
2023-06-20 18:18 ` [PATCH 03/21] Exclude routines from fortification Frédéric Bérat
2023-06-20 18:18 ` [PATCH 04/21] sysdeps/{i386,x86_64}/mempcpy_chk.S: fix linknamespace for __mempcpy_chk Frédéric Bérat
2023-06-21 12:27 ` Siddhesh Poyarekar
2023-06-21 17:26 ` Noah Goldstein
2023-06-22 4:02 ` Siddhesh Poyarekar
2023-06-20 18:18 ` [PATCH 05/21] stdio-common: tests: Incorrect maxlen parameter for swprintf Frédéric Bérat
2023-06-21 12:29 ` Siddhesh Poyarekar
2023-06-20 18:18 ` [PATCH 06/21] sysdeps: Ensure ieee128*_chk routines to be properly named Frédéric Bérat
2023-06-20 18:18 ` [PATCH 07/21] string: Ensure *_chk routines have their hidden builtin definition available Frédéric Bérat
2023-06-20 18:18 ` [PATCH 08/21] stdio: " Frédéric Bérat
2023-06-20 18:18 ` Frédéric Bérat [this message]
2023-06-20 18:18 ` [PATCH 10/21] misc/sys/cdefs.h: Create FORTIFY redirects for internal calls Frédéric Bérat
2023-06-20 18:18 ` [PATCH 11/21] wcsmbs/bits/wchar2{,-decl}.h: Clearly separate declaration from definitions Frédéric Bérat
2023-06-22 4:19 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 12/21] wcsmbs/bits/wchar2{,-decl}.h: Avoid PLT entries with _FORTIFY_SOURCE Frédéric Bérat
2023-06-20 18:19 ` [PATCH 13/21] posix/bits/unistd.h: Clearly separate declaration from definitions Frédéric Bérat
2023-06-22 4:17 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 14/21] posix/bits/unistd{,-decl}.h: Avoid PLT entries with _FORTIFY_SOURCE Frédéric Bérat
2023-06-20 18:19 ` [PATCH 15/21] debug/readlink{,at}_chk.c: Harmonize declaration and definition Frédéric Bérat
2023-06-22 4:11 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 16/21] misc/bits/select2.h: Clearly separate declaration from definitions Frédéric Bérat
2023-06-22 4:16 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 17/21] misc/bits/syslog.h: Clearly separate declaration from definition Frédéric Bérat
2023-06-22 4:24 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 18/21] rt/tst-mqueue4.c: Fix wrong number of argument for mq_open Frédéric Bérat
2023-06-21 12:26 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 19/21] sysdeps/ieee754/ldbl-128ibm-compat: Fix warn unused result Frédéric Bérat
2023-06-21 11:56 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 20/21] sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: " Frédéric Bérat
2023-06-21 11:45 ` Siddhesh Poyarekar
2023-06-20 18:19 ` [PATCH 21/21] benchtests: fix " Frédéric Bérat
2023-06-21 11:42 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230620181910.1506893-10-fberat@redhat.com \
--to=fberat@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=siddhesh@gotplt.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).