From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id C49213858417 for ; Tue, 14 Mar 2023 22:07:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C49213858417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org References: <20230314002354.367655-1-sam@gentoo.org> User-agent: mu4e 1.8.14; emacs 29.0.60 From: Sam James To: Kito Cheng Cc: Richard Biener , gcc-patches@gcc.gnu.org, Palmer Dabbelt , Andrew Waterman , Jim Wilson , Ju-Zhe Zhong Subject: Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Date: Tue, 14 Mar 2023 22:06:48 +0000 In-reply-to: Message-ID: <87sfe76l8c.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_SHORT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP 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: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Kito Cheng writes: > committed to trunk, thanks :) > > On Tue, Mar 14, 2023 at 9:44=E2=80=AFPM Kito Cheng = wrote: >> >> RISC-V part is ok, and I assume you didn't have write access so I'm >> gonna push that since the system.h change also got approved :) Thanks a bunch! :) >> >> On Tue, Mar 14, 2023 at 5:07=E2=80=AFPM Richard Biener via Gcc-patches >> wrote: >> > >> > On Tue, Mar 14, 2023 at 1:24=E2=80=AFAM Sam James via Gcc-patches >> > wrote: >> > > >> > > This fixes errors like: >> > > ``` >> > > In file included from /usr/include/pthread.h:30, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/ext/atomicity.h:35, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/bits/ios_base.h:39, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/ios:42, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/istream:38, >> > > from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/incl= ude/g++-v12/sstream:38, >> > > from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230= 305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22: >> > > /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc" >> > > 84 | void *calloc(size_t, size_t); >> > > | ^ >> > > /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc" >> > > 124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n= ))) >> > > | ^ >> > > make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1 >> > > ``` >> > > >> > > See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36= fb1a9b6aad9666b1edb5e06474, >> > > which was fixed in PR106102. >> > >> > The system.h change is OK >> > >> > > gcc/ChangeLog: >> > > * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poison= ing on musl by >> > > including earlier. >> > > * system.h: Add INCLUDE_SSTREAM. >> > > >> > > Signed-off-by: Sam James >> > > --- >> > > gcc/config/riscv/genrvv-type-indexer.cc | 2 +- >> > > gcc/system.h | 4 ++++ >> > > 2 files changed, 5 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/ri= scv/genrvv-type-indexer.cc >> > > index 0ef1d766002..e677b55290c 100644 >> > > --- a/gcc/config/riscv/genrvv-type-indexer.cc >> > > +++ b/gcc/config/riscv/genrvv-type-indexer.cc >> > > @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3. If not s= ee >> > > . */ >> > > >> > > #include "bconfig.h" >> > > +#define INCLUDE_SSTREAM >> > > #include "system.h" >> > > #include "errors.h" >> > > >> > > #include "coretypes.h" >> > > >> > > -#include >> > > #include >> > > #include >> > > >> > > diff --git a/gcc/system.h b/gcc/system.h >> > > index 64cd5a49258..cf45db3f97e 100644 >> > > --- a/gcc/system.h >> > > +++ b/gcc/system.h >> > > @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const cha= r *, va_list); >> > > # include >> > > #endif >> > > >> > > +#ifdef INCLUDE_SSTREAM >> > > +# include >> > > +#endif >> > > + >> > > #ifdef INCLUDE_MALLOC_H >> > > #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) >> > > #include >> > > -- >> > > 2.40.0 >> > > --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOQEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZBDwBF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZDDDgD2IgMnDLYdp59FvRqFDoiymmznS/NKRH6DEv5G p5bgiwD/dL/JN2f+WUm1bqWR8Pw3RXlpkdCChbeUCcEvRJ6KOgg= =Oemn -----END PGP SIGNATURE----- --=-=-=--