From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24685 invoked from network); 19 Mar 2022 08:44:30 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 19 Mar 2022 08:44:30 -0000 Received: (qmail 26054 invoked by uid 550); 19 Mar 2022 08:44:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 26019 invoked from network); 19 Mar 2022 08:44:26 -0000 Date: Sat, 19 Mar 2022 09:44:14 +0100 From: Szabolcs Nagy To: "Kenny, Joseph P" Cc: "musl@lists.openwall.com" Message-ID: <20220319084414.GJ1320090@port70.net> Mail-Followup-To: "Kenny, Joseph P" , "musl@lists.openwall.com" References: <323912A7-59BB-43DF-B250-4C93BE06797A@sandia.gov> <79055819-8B6E-4B53-AA1C-638B7E4C7FF7@sandia.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <79055819-8B6E-4B53-AA1C-638B7E4C7FF7@sandia.gov> Subject: Re: [musl] Re: [EXTERNAL] [musl] C++ segfault on riscv64 * Kenny, Joseph P [2022-03-18 16:48:11 +0000]: > Sorry for the confusing post. I get the same behavior on qemu for both ri= scv64 and riscv32. I posted output from riscv32. >=20 > Here is the C++ code: > $ cat hello.cc > #include > int main() { > std::cout << "Hello\n"; > return 0; > } >=20 > From: "Kenny, Joseph P" > Reply-To: "musl@lists.openwall.com" > Date: Friday, March 18, 2022 at 9:42 AM > To: "musl@lists.openwall.com" > Subject: [EXTERNAL] [musl] C++ segfault on riscv64 >=20 > I=E2=80=99m getting segfaults with musl for C++ code on riscv64. I have t= ested mipsel using qemu user mode as described below and found no issues. >=20 > I=E2=80=99m cross-compiling using the latest riscv64-linux-musl-cross.tgz= (23-Nov-2021) from musl.cc on x86_64/Fedora 35. I have confirmed that I ge= t the following behavior for both riscv64 hardware and qemu user mode. =2E.. > C++ segfaults: >=20 > $ riscv32-linux-musl-g++ -static -g -Og hello.cc -o hello > $ qemu-riscv32 hello > Segmentation fault (core dumped) >=20 > GDB confirms the segfault in __dynamic_cast on both qmeu and riscv64 hard= ware. I=E2=80=99ll paste in the assembly below. Segfault occurs on the last= instruction shown [ld a5,0(a0)]. >=20 > I=E2=80=99ve taken this as far as my skills allow. Any ideas what=E2=80= =99s going on here or how to debug further? listdc++ iostreams initializers call __dynamic_cast many times (this is all in libstdc++, nothing to do with musl). you need to figure out which cast fails and why the type info is corrupt. e.g. build libstdc++ with debug info and printing the backtrace may help.