From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by sourceware.org (Postfix) with ESMTPS id C9ED33857C50 for ; Tue, 27 Jul 2021 13:23:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9ED33857C50 Received: from collabora.com (unknown [IPv6:2001:4d48:ad5c:ef00:8e70:5aff:fe59:c29c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: vivek) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id A22191F431E8; Tue, 27 Jul 2021 14:23:45 +0100 (BST) Date: Tue, 27 Jul 2021 14:23:43 +0100 (BST) From: =?UTF-8?Q?Vivek_Das=C2=A0Mohapatra?= X-X-Sender: vivek@noise.cbg.collabora.co.uk To: Adhemerval Zanella cc: Fengkai Sun , libc-help@sourceware.org Subject: Re: Enable preloading in dlopen-ed shared libraries? In-Reply-To: Message-ID: References: <81d3637d-8ea4-4048-98de-584e813ddeaf@linaro.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 13:23:48 -0000 > to support on next 2.35 (RTLD_SHARED): > > void *h = dlmopen (LM_ID_NEWLM, "othermalloc.so", RTLD_NOW) > Lmid_t id; > dlinfo (h, RTLD_DI_LMID, &id); > dlmopen (id, "lib1.so", RTLD_SHARED | RTLD_NOW); > > The lib1.so will then bind its dependencies only on the newly created > namespace scope (LD_PRELOAD won't be added in this case). So a subsequent > dlopen ("lib1.so", ...) will return the handler to the lib1.so already > created in the extra namespace. > > (Vivek can correct me if I am wrong here) That's how it should work, yes. I should probably add a set of tests to check this exact scenario to the test suite.