[PATCH 03/11] libio: Add fortify wrapper for internal __snprintf
Florian Weimer
fweimer@redhat.com
Tue Feb 13 12:13:05 GMT 2024
* 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.
Thanks,
Florian
More information about the Libc-alpha
mailing list