From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by sourceware.org (Postfix) with ESMTPS id 7B2C13857359; Tue, 16 May 2023 06:53:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B2C13857359 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230516065317euoutp016fda04153b1fcb7446de7d000475c0d8~fjSoGNHwV1040610406euoutp01H; Tue, 16 May 2023 06:53:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230516065317euoutp016fda04153b1fcb7446de7d000475c0d8~fjSoGNHwV1040610406euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1684219997; bh=vjtaPrSuNMFS2Gk6/PCl2WLQTXLUSgTY/h1GRdA2rR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EntktS0MLOYWCLTag41JSTNzI/aklY7x3JNYkb1igtGG1XgTaDpmkapHLcPAI2EDx c5BfD9kOb3TLFRfSTUuJpyyZUICR3Vh8ySZrMybm3/ynCVqsFPTrSqDsuZ12eCwiSj OlP6Cdg7/iRFrcFTRJvCopK9ggAVr2+oA5TX0KTo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230516065316eucas1p16d818bebf6376423b2744428da8d60dd~fjSny1Pdo1454614546eucas1p1y; Tue, 16 May 2023 06:53:16 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 89.33.37758.C5823646; Tue, 16 May 2023 07:53:16 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230516065316eucas1p17bffcd25209bb441b9a9f4d263aa8b3c~fjSnXHhED1455014550eucas1p1q; Tue, 16 May 2023 06:53:16 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230516065316eusmtrp1334b02c04f6cc3cd7a4fce0f964f2bba~fjSnWbl141192111921eusmtrp1p; Tue, 16 May 2023 06:53:16 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-db-6463285cb032 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 62.86.10549.C5823646; Tue, 16 May 2023 07:53:16 +0100 (BST) Received: from localhost (unknown [106.120.51.111]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230516065316eusmtip2236ec115d288db59a29b5cbd520fb5a2~fjSnH33uH2831528315eusmtip2W; Tue, 16 May 2023 06:53:16 +0000 (GMT) From: Lukasz Stelmach To: Palmer Dabbelt Cc: fw@deneb.enyo.de, libc-alpha@sourceware.org, schwab@suse.de, maskray@google.com, fweimer@redhat.com, adhemerval.zanella@linaro.org, joseph@codesourcery.com, binutils@sourceware.org, m.pikula@partner.samsung.com, m.szyprowski@samsung.com, k.lewandowsk@samsung.com Subject: Re: global pointer gets overwritten with dlopen(3) on RISC-V Date: Tue, 16 May 2023 08:53:03 +0200 In-Reply-To: (Palmer Dabbelt's message of "Mon, 15 May 2023 06:47:09 -0700 (PDT)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha256"; protocol="application/pgp-signature" X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBKsWRmVeSWpSXmKPExsWy7djP87oxGskpBv3bTSym7l/GZPFx2h5G i4OHJ7BZfJ+zm8ni8IdOdovGT3O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6wuOlHf6z0po5Pr25qAtt1b1 dWmRaSEvT8e9mSz1R3na348zUveuvL/iVt60iZrak4X0Z/2aJcgjs5+vdyLTyl0vnUM2rla4 Ytp/JIhz98KI9RXyTZk+VUf+PcvabWD6tOypVeGDHUosxRmJhlrMRcWJAAFXaDVxAwAA X-CMS-MailID: 20230516065316eucas1p17bffcd25209bb441b9a9f4d263aa8b3c X-Msg-Generator: CA X-RootMTR: 20230516065316eucas1p17bffcd25209bb441b9a9f4d263aa8b3c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230516065316eucas1p17bffcd25209bb441b9a9f4d263aa8b3c References: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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: --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It was <2023-05-15 pon 06:47>, when Palmer Dabbelt wrote: > On Fri, 12 May 2023 08:13:10 PDT (-0700), fw@deneb.enyo.de wrote: >> * Lukasz Stelmach via Libc-alpha: >> >>> We've got a program (the testee) written in C that we test with another >>> one (a testing harness, the tester) written in C++ with gtest. So far, >>> so good. To make the testing and inspection of the internal state of the >>> testee easier the tester does not start the testee as a separate process >>> but loads it with dlopen(3) and calls the testee's main() function. >> >> We specifically disallow this in current glibc because it does not >> work in general=E2=80=94unless the application is really loadable as a s= hared >> object (compiled as PIC and linked with -shared). > > Just popping back up here, as we got lost in the ABI discussions and > were talking about it during the glibc patchwork call: essentially it=20 > boils down to us needing a more concrete reproducer for the bug. > > If GP is used in a shared object then we've got a bug somewhere, No, the file we dlopen is an executable meant to work standalone. We dlopen it for testing and this setup has worked for us on different platforms (armv7l, aarch64, x86). We MAY have not encoutered an error because our glibc has been patched. I have to investigate the details as Florian brough it to our attention that an error should be reported. > probably the linker. There's been some debate about what things like=20 > position independent mean in RISC-V land, so it's entirely possible > there's something odd floating around here. If you can reproduce that=20 > it's probably a bug, but probably a LD/LLD bug. > > It sounds like there are no known bugs in glibc related to loading > executables via dlopen(), as that doesn't work for any port due to a=20 > host of reasons (GP is just one of them). We might have some bug > floating around, RISC-V specific or otherwise, though. If you have a=20 > reproducer for that then we can try and sort things out. Now that I know I should get an error I will look more closely to see what is going on. Thank you, everyone, for your comments. They will help me a lot. =2D-=20 =C5=81ukasz Stelmach Samsung R&D Institute Poland Samsung Electronics --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEXpuyqjq9kGEVr9UQsK4enJilgBAFAmRjKE8ACgkQsK4enJil gBCnKQf/Y66Jm0bXasKVOfPnhUfvdxHYZGNIg4CSSlz530iLUUdkU82+k4RA3zbZ isGvO7TNcrCMz6jFugd8H2W2Bp6IhjrjDC3qU64XDNS0NArDMtrTRXWmjxvNrK3d ASxVWoebieGg38v8DaxwnsEZoBVvnKkNwvbkfOEWMD9cBiS5ldEGXcUfXD1n0hHF /KEPVQ0Gasg+vj4en/GZdDL1CE7+cWcf81uMwBbgxc4Itr1z/U7CuYInRY+Cjgdb AtU8pG8dWwISLYQCyds4WYxZtSAUpzpDSKndAX336vuHGkaAHGyOzyhTbAydC7Nh C+Y+kMBa7fi8ZpzEtTjHTUkT5TVxnA== =ljNU -----END PGP SIGNATURE----- --=-=-=--