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=-1.0 required=5.0 tests=HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8946 invoked from network); 2 Nov 2022 03:17:16 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Nov 2022 03:17:16 -0000 Received: (qmail 15846 invoked by uid 550); 2 Nov 2022 03:17:11 -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 15808 invoked from network); 2 Nov 2022 03:17:10 -0000 From: guolongqiang To: "musl@lists.openwall.com" Thread-Topic: Questions about dlopen Thread-Index: AdjuZwYqc6uZzRL/SiSMHAF1R2nGUg== Date: Wed, 2 Nov 2022 03:16:56 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.178.148] Content-Type: multipart/alternative; boundary="_000_d2b3c2be87bc40b19ed0e7c60fcda73dhuaweicom_" MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: [musl] Questions about dlopen --_000_d2b3c2be87bc40b19ed0e7c60fcda73dhuaweicom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear maintainer, How does RTLD_LAZY option in dlopen work on musl libc? As I can't find any = runtime resolve interface. But I find that we support dlopen5, which depends on caller providing a res= olve hook. Thanks --_000_d2b3c2be87bc40b19ed0e7c60fcda73dhuaweicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Dear = maintainer,

 

How does RTLD_LAZY option in dl= open work on musl libc? As I can’t find any runtime resolve interface= .

But I find that we support dlop= en5, which depends on caller providing a resolve hook.

 

Thanks

--_000_d2b3c2be87bc40b19ed0e7c60fcda73dhuaweicom_-- 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=-1.0 required=5.0 tests=HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10049 invoked from network); 2 Nov 2022 03:26:20 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Nov 2022 03:26:20 -0000 Received: (qmail 23883 invoked by uid 550); 2 Nov 2022 03:26:17 -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 23840 invoked from network); 2 Nov 2022 03:26:15 -0000 From: guolongqiang To: "musl@lists.openwall.com" CC: changdiankang Thread-Topic: Questions about dlopen Thread-Index: AdjuZwYqc6uZzRL/SiSMHAF1R2nGUgAA7FXQ Date: Wed, 2 Nov 2022 03:26:02 +0000 Message-ID: <84e4e0aac03741bfb605790aba94f0fe@huawei.com> References: In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.178.148] Content-Type: multipart/alternative; boundary="_000_84e4e0aac03741bfb605790aba94f0fehuaweicom_" MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: [musl] =?gb2312?B?tPC4tDogUXVlc3Rpb25zIGFib3V0IGRsb3Blbg==?= --_000_84e4e0aac03741bfb605790aba94f0fehuaweicom_ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 SaGvbSBzb3JyeSBmb3IgZGxvcGVuNSwgaWdub3JlIHRoYXQuDQoNCreivP7IyzogZ3VvbG9uZ3Fp YW5nIFttYWlsdG86Z3VvbG9uZ3FpYW5nQGh1YXdlaS5jb21dDQq3osvNyrG85DogMjAyMsTqMTHU wjLI1SAxMToxNw0KytW8/sjLOiBtdXNsQGxpc3RzLm9wZW53YWxsLmNvbQ0K1vfM4jogW211c2xd IFF1ZXN0aW9ucyBhYm91dCBkbG9wZW4NCg0KRGVhciBtYWludGFpbmVyLA0KDQpIb3cgZG9lcyBS VExEX0xBWlkgb3B0aW9uIGluIGRsb3BlbiB3b3JrIG9uIG11c2wgbGliYz8gQXMgSSBjYW6hr3Qg ZmluZCBhbnkgcnVudGltZSByZXNvbHZlIGludGVyZmFjZS4NCkJ1dCBJIGZpbmQgdGhhdCB3ZSBz dXBwb3J0IGRsb3BlbjUsIHdoaWNoIGRlcGVuZHMgb24gY2FsbGVyIHByb3ZpZGluZyBhIHJlc29s dmUgaG9vay4NCg0KVGhhbmtzDQo= --_000_84e4e0aac03741bfb605790aba94f0fehuaweicom_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

I=A1=AF= m sorry for dlopen5, ignore that.

&n= bsp;

=B7=A2=BC=FE=C8=CB: guolongqiang [mailto:guolongqiang@huawei.com]
=B7=A2=CB=CD=CA=B1=BC=E4:<= /span> 2022=C4=EA11=D4=C22=C8=D5 11:17
=CA=D5=BC=FE=C8=CB: musl@lists.openwall.com
=D6=F7=CC=E2: [musl] Questions about dlopen

 

Dear = maintainer,

 

How does RTLD_LAZY option in dl= open work on musl libc? As I can=A1=AFt find any runtime resolve interface.=

But I find that we support dlop= en5, which depends on caller providing a resolve hook.

 

Thanks

--_000_84e4e0aac03741bfb605790aba94f0fehuaweicom_-- 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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15018 invoked from network); 2 Nov 2022 12:56:46 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Nov 2022 12:56:46 -0000 Received: (qmail 6137 invoked by uid 550); 2 Nov 2022 12:56:40 -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 6099 invoked from network); 2 Nov 2022 12:56:40 -0000 Date: Wed, 2 Nov 2022 08:56:28 -0400 From: Rich Felker To: guolongqiang Cc: "musl@lists.openwall.com" Message-ID: <20221102125627.GD29905@brightrain.aerifal.cx> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Questions about dlopen On Wed, Nov 02, 2022 at 03:16:56AM +0000, guolongqiang wrote: > Dear maintainer, > > How does RTLD_LAZY option in dlopen work on musl libc? As I can't > find any runtime resolve interface. We intentionally do not have any runtime resolve interface. This is because, in implementations that do use one, it's historically been a gigantic source of bugs. This is partly because it runs in an extremely restricted context where it can't make any assumptions about availability of locks or having consistent state, and partly because it has to be able to save and restore the entire register file, even registers that didn't exist when it was written, because the application's calling convention might be using them to pass arguments. RTLD_LAZY does not carry a contract for dlopen to do lazy resolution, it just allows it. Originally, we just completely ignored it. Because some software (notably, X.org server modules) was written to depend on RTLD_LAZY, commit 6476b8135760659b25c93ff9308425ca98a9e777 introduced a "deferred relocation" feature that behaves the same from the standpoint of the application. Since the set of available symbols to bind to only changes when new libraries are loaded with dlopen, it works like this: - If RTLD_LAZY was passed to dlopen, missing symbols are not treated as an error. - Instead, the relocations referring to them are saved in a list to be reprocessed later. - After each subsequent dlopen, all these deferred relocation lists are re-processed and any relocations referring to symbols that are now defined get applied, and removed from the list. > But I find that we support dlopen5, which depends on caller > providing a resolve hook. I know you said in the follow-up to disregard dlopen5. Regarding a resolve hook, there is no resolve function so nothing to hook. More broadly, musl does not provide or support any kind of hooking of internals. Rich