From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 03/11] libio: Add fortify wrapper for internal __snprintf
Date: Tue, 13 Feb 2024 10:16:20 -0300 [thread overview]
Message-ID: <84667fbb-edcc-4c97-b914-904ca2e391d4@linaro.org> (raw)
In-Reply-To: <87eddgimum.fsf@oldenburg.str.redhat.com>
On 13/02/24 09:13, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
>
>> On 09/02/24 12:25, Florian Weimer wrote:
>>> ---
>>> debug/snprintf_chk.c | 1 +
>>> include/bits/stdio2.h | 9 +++++++++
>>> include/stdio.h | 1 +
>>> 3 files changed, 11 insertions(+)
>>>
>>> diff --git a/debug/snprintf_chk.c b/debug/snprintf_chk.c
>>> index 995d805f5d..ea02efec3e 100644
>>> --- a/debug/snprintf_chk.c
>>> +++ b/debug/snprintf_chk.c
>>> @@ -40,4 +40,5 @@ ___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
>>>
>>> return ret;
>>> }
>>> +ldbl_hidden_def (___snprintf_chk, __snprintf_chk)
>>> ldbl_strong_alias (___snprintf_chk, __snprintf_chk)
>>
>> I am seeing a build failure on powerpc64le with config options
>> --enable-stack-protector=all --enable-tunables=yes --enable-bind-now=yes
>> --enable-profile=yes --enable-fortify-source=2 --enable-hardcoded-path-in-tests:
>>
>> powerpc64le-glibc-linux-gnu-gcc gconv_conf.c -c -std=gnu11 -fgnu89-inline -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector-all -fno-common -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Wstrict-prototypes -Wold-style-definition -fmath-errno -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute -mlong-double-128 -fPIE [....]
>> In file included from gconv_conf.c:26:
>> ../include/stdio.h:65:1: error: ‘asm’ declaration ignored due to conflict with previous rename [-Werror=pragmas]
>> 65 | stdio_hidden_ldbl_proto (__, snprintf_chk)
>> | ^~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>>
>> All other ABIs build fine.
>
> The issue seems to be that libio/bits/stdio-ldbl.h wants to alias
> __snprintf_chk to __snprintf_chkieee128, and stdio_hidden_ldbl_proto
> wants to create an alias to ___ieee128_snprintf_chk.
>
> I don't know how to solve this properly. It seems that so far, few of
> the fortified variants in the printf function family have hidden aliases
> for PLT avoidance.
Maybe something like:
diff --git a/include/stdio.h b/include/stdio.h
index 364f4d22a1..0fda47cf82 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -24,7 +24,7 @@
directly alias them to their internal name. */
# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
+ libc_hidden_proto_alias (p ## f, ___ieee128_ ## p ## f)
# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
# else
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf_chk.c
index d5bd6aa25f..566f525a9c 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf_chk.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf_chk.c
@@ -40,3 +40,4 @@ ___ieee128___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
return done;
}
strong_alias (___ieee128___snprintf_chk, __snprintf_chkieee128)
+libc_hidden_ver (__snprintf_chkieee128, ___ieee128___snprintf_chk)
next prev parent reply other threads:[~2024-02-13 13:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 15:24 [PATCH 00/11] Build getdomainname, gethostname, syslog with fortification Florian Weimer
2024-02-09 15:24 ` [PATCH 01/11] misc: Build getdomainname " Florian Weimer
2024-02-12 17:14 ` Adhemerval Zanella Netto
2024-02-12 17:30 ` Andreas Schwab
2024-02-12 19:29 ` Florian Weimer
2024-02-13 9:12 ` Andreas Schwab
2024-02-13 9:23 ` Florian Weimer
2024-02-13 9:32 ` Andreas Schwab
2024-02-09 15:24 ` [PATCH 02/11] misc: Build gethostname " Florian Weimer
2024-02-12 17:25 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 03/11] libio: Add fortify wrapper for internal __snprintf Florian Weimer
2024-02-12 17:34 ` Adhemerval Zanella Netto
2024-02-13 12:13 ` Florian Weimer
2024-02-13 13:16 ` Adhemerval Zanella Netto [this message]
2024-02-09 15:25 ` [PATCH 04/11] syslog: Update misc/tst-syslog to check reported %n value Florian Weimer
2024-02-13 11:59 ` Adhemerval Zanella Netto
2024-02-15 13:23 ` Florian Weimer
2024-02-09 15:25 ` [PATCH 05/11] syslog: Build with fortification Florian Weimer
2024-02-13 12:26 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 06/11] stdio: Rename __printf_buffer to __vfprintf_buffer Florian Weimer
2024-02-16 13:40 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 07/11] libio: Extract __printf_buffer_asprintf_init from asprintf implementation Florian Weimer
2024-02-16 14:04 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 08/11] stdio-common: Introduce the __printf_buffer function Florian Weimer
2024-02-16 14:12 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 09/11] stdio-common: Allow skipping initial bytes in __printf_buffer for %n Florian Weimer
2024-02-16 14:13 ` Adhemerval Zanella Netto
2024-02-09 15:25 ` [PATCH 10/11] stdio-common: Support large offsets with %lln Florian Weimer
2024-02-16 14:20 ` Adhemerval Zanella Netto
2024-02-09 15:26 ` [PATCH 11/11] syslog: Use a printf buffer directly to construct the entire packet Florian Weimer
2024-02-14 15:16 ` Adhemerval Zanella Netto
2024-02-15 13:02 ` Florian Weimer
2024-02-16 13:35 ` Adhemerval Zanella Netto
2024-02-16 15:58 ` Adhemerval Zanella Netto
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=84667fbb-edcc-4c97-b914-904ca2e391d4@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.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).