From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D450C3858D28 for ; Mon, 3 Jul 2023 05:35:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D450C3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688362536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VlOEyTiCrlE2dXrZ4ZcXQX+pCXjM8qzRdgKlxNFgcK4=; b=JPkwNscZ8sNNzP6Trpy55u0bBEZOZtvAlenDoycrida3qrBmsfZenv6L+Wfrr5h6hehzkD Ms4Shu38MQ9tjX4DwktD0sSkwLsAD4DJgwiyttjNS1gshADUH4unOqELYNxe87P1UgRN8F WKY5jfqfyfTf8zxCuSa64yPURNHczmE= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-417-XfC9xJqEOk2oIXEF56oQiA-1; Mon, 03 Jul 2023 01:35:33 -0400 X-MC-Unique: XfC9xJqEOk2oIXEF56oQiA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-987accb96dbso284396666b.2 for ; Sun, 02 Jul 2023 22:35:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688362532; x=1690954532; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VlOEyTiCrlE2dXrZ4ZcXQX+pCXjM8qzRdgKlxNFgcK4=; b=MStUZDuzGL1G3KVcRzVk9ilJn/s/ssIoLsNl6Th2iishmcpC5xDj2Sfs/qzaFb5ieH wuDQBlo7jsOjPBTFhS8CzJTcTYbgljtqDlxyeUSqnyVdhGPA7BUdWcVQga67Fyy2QJua bpF/L0vfHwQ5Zp5XJ6twmq7X2uCTzfEUvaCMatmXzAuqr4AjrQgsaiL2QT/MbNifomTI Ii5SeQVdOtKoZC5qHL+MAp6NoyOn+tj04GhhjL4nMZLyytGsQtGWV7kl+tpFRirlWl5z pMQpF833YNAjW+hDlivXdu5Qj6jt5ONWliEhY2HHcpKRt0gBB8veHcBAZ7nAhnQu3KFV ouRw== X-Gm-Message-State: ABy/qLajXnlajxUzXczbSc+OhAKBGm3ohb+RgA1cUTWYU1eX7jSH63O5 oD8bWYobWc8+0xD5S9EJmjigdS/980NBNX8snBHzUfEq+ZRjkLxkiDm96bJTenryL0Jo03B58Pj FzIs73RWJ1V2tfe/RvVyLn3+B8d5LUFJ9JqcouiuODEYulaQ= X-Received: by 2002:a17:907:20ac:b0:98c:d355:bb38 with SMTP id pw12-20020a17090720ac00b0098cd355bb38mr6293497ejb.11.1688362532100; Sun, 02 Jul 2023 22:35:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnTlA0pmIpGLG3Qf35ZN7qiJFo43UXVTbz68QPB71FBs+108ywl3Rat4OtLpB5zm3djzBvRleSDm78s55R9rw= X-Received: by 2002:a17:907:20ac:b0:98c:d355:bb38 with SMTP id pw12-20020a17090720ac00b0098cd355bb38mr6293486ejb.11.1688362531792; Sun, 02 Jul 2023 22:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20230628084246.778302-1-fberat@redhat.com> <20230628084246.778302-7-fberat@redhat.com> In-Reply-To: From: Frederic Berat Date: Mon, 3 Jul 2023 07:35:21 +0200 Message-ID: Subject: Re: [PATCH v3 06/16] asprintf_chk: Ensure compatibility for both s390x and ppc64le To: Paul E Murphy Cc: libc-alpha@sourceware.org, siddhesh@gotplt.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f5bdb305ff8e8847" X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: --000000000000f5bdb305ff8e8847 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 30, 2023 at 7:51=E2=80=AFPM Paul E Murphy wrote: > > > On 6/28/23 3:42 AM, Fr=C3=A9d=C3=A9ric B=C3=A9rat via Libc-alpha wrote: > > 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 =3D= =3D 1 > > +/* This is needed since 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. > > s/versionned/versioned/ > > It has been a few years since I really looked at this macros, why only > asprintf and not the other printf functions? I find the ABI comment > hard to follow, could it include more details about how it would be > broken by using the ldbl_* macros? > I didn't do this for other functions as it didn't appear to be necessary. Yes, I can be more specific about the breakage. Basically, the __asprintf_chk routine disappears from the ABI list on s390x, which breaks linkage. That is due to the fact that ldbl_strong_alias may create *versioned* alias (depending on build options), while strong_alias never does. I'll expand on the comment, I can reproduce the error to be explicit about it. > > Also, does patchset 5 in this series break ppc64le or s390x build > without this patch? This seems like it should be squashed with the > previous patch. > On s390x yes, not ppc. I was afraid to kind of hide this change in the middle of the other changes, that's why I kept them separated, so that this gets carefully reviewed. I can squash this into patch 5 if you are fine with it. > > + */ > > +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 =3D= =3D 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) > > --000000000000f5bdb305ff8e8847--