Enable preloading in dlopen-ed shared libraries?

Vivek Das Mohapatra vivek@collabora.com
Tue Jul 27 13:23:43 GMT 2021


> 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.



More information about the Libc-help mailing list