From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 4CAC13858C52 for ; Tue, 13 Feb 2024 13:16:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4CAC13858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4CAC13858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::533 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707830186; cv=none; b=ShxQ9AWSlFu92lMAuqwOdzbN1U0VFirf03gKoZkfb+wfFiQbiUxyLQMCKUfCGmXiqf6vgqDA7b6HYosdCUBzDQviryz9PuBQaBYPjy65Ian/gSWKwwOdXLfrUF4ddz5R78phVrM1u+XaPevhCCgPSnGwD35seIneGFcHOHjAnU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707830186; c=relaxed/simple; bh=kOdOAj/Vuq3UITf/nnY7faQEf3nautk1fJE4j7hTtIQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=J+HnNnMcefGyxsi+JT8xX06zTiJ3FcC+TLFjlEdJ/o/Bk3FLm9bhgSQ9hw7EzHLitptHFlElGv2LZi7DdBFLDtm4SZmWyqxoSpFv0ZWsGTxq6/HjZPpZ+mcWxpGiyH+VheTt1LJRHepclwmgkY5qb635P4AGLpiJHPHJVCOMytk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5cdf76cde78so3368356a12.1 for ; Tue, 13 Feb 2024 05:16:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707830183; x=1708434983; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=OfTkcaw9y23Wxa56i/cUWwIOt+AgdtYGSBn0gRHTfLE=; b=Zt6srsIdXsFIbMDKHD8u3Uhy8nHZ/94z+iGhUM5GCVYxS5otbjYytUTbasS+kZoiCH 9RLYvqt8murGrocg43r3Bhe/aplAIEgrSKP8G7rEB2sfbXzYFTljV8/JgUbpeb4c2Ekk DDuZcLlFVVol4g9GsLXd3rvOxzW+L0oIbRTKW1E+EySIKEa9smJOU204Wc/YmjBeXewc 2X+8GCSg0QZYtlBmU0VMxDs1S5PI6/jX6M2k+NxZ/US8lqHXToAin0Nxj9twaV591sqc +5lPxF2oKCXeVFku7m1wXbTC0KbbXbyEIwqt4r72wkwEecVEGKgvRCRw7+Qq9DUJwatz z/Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707830183; x=1708434983; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OfTkcaw9y23Wxa56i/cUWwIOt+AgdtYGSBn0gRHTfLE=; b=H35sahFENuH62GyEVsoL3VY7mRvKHLUSNsNvei6Or7hVv0DBH3SLlHdOuQV7RqIfys LO4zUmBxWJ+PQe86XxodurXJkfHxxg+ex5uYgwU2gKs9ewqGi77RQWp6iRs4DdXPDE+P 2qFg/whxfhUyi0FRy55CA6NQU4PUrVSB9esLwm/B1RBkn7h2Sj42N6KfVZ0dXmv6PeWw Y3dz2DvAuYv4a2UrKW5xrlX46getdH8QDdNk2cu+aEMJi1Up8usNXfMDP9A8/gBwVBYa lrHa4m6kfhaSKOrX4a+kbpEo696Q+j5t2Au3gujVGyBcGV2426Y3OsZVeAi+5+LxmI1Y xnLA== X-Gm-Message-State: AOJu0Yy6QWPuh1eYU3SI77LdGKKtBW3umAg2EUJDGUm1zJHuOj6lyvbo X/Vs5EX3PIkfiw/LT+x+rn5/vi1kilifoPE0wub7bF6riE4GaW8U6SfhSLpObd4KH9YoYdAJin8 8 X-Google-Smtp-Source: AGHT+IHKpDbEGWDjWhrj20Cxcgp5I2ApfEHG1gS9EvTQh2wHcVp9lPXemncZgKTwVReB4xTpFG4nyQ== X-Received: by 2002:a05:6a20:e614:b0:19e:a335:84a2 with SMTP id my20-20020a056a20e61400b0019ea33584a2mr8185845pzb.44.1707830183214; Tue, 13 Feb 2024 05:16:23 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c0:378:8ce8:2e09:3517:29cf? ([2804:1b3:a7c0:378:8ce8:2e09:3517:29cf]) by smtp.gmail.com with ESMTPSA id lx4-20020a17090b4b0400b00296ba96cda9sm2426153pjb.55.2024.02.13.05.16.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 05:16:22 -0800 (PST) Message-ID: <84667fbb-edcc-4c97-b914-904ca2e391d4@linaro.org> Date: Tue, 13 Feb 2024 10:16:20 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 03/11] libio: Add fortify wrapper for internal __snprintf Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org References: <45d399f3e70726984705466772370ba33ce3aa8a.1707491940.git.fweimer@redhat.com> <87eddgimum.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <87eddgimum.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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)