[Devel] dlopen(... RTLD_LOCAL vs. RTLD_GLOBAL

Bogdan-Andrei Iancu bogdan at voice-system.ro
Mon Nov 27 18:24:40 CET 2006


Hi,

I think we should go for the "best, but more difficult" option - how a 
module is to be load must be 100% transparent for the user, so this 
information should not reside in script, but in the module interface.

let's have a new field in the interface saying how the module should be 
load - if set to RTLD_GLOBAL, the module will be accordingly reloaded.

regards,
bogdan

Daniel-Constantin Mierla wrote:

> Hello Bastian,
>
> I will check the sl and tm code to get the collision fixed, it is 
> better to avoid it, but I am afraid that other modules will have this 
> problem (db ones especially...). Also, RTLD_GLOBAL should be used only 
> if necessary, I don't think that all symbols should become available.
>
> Your proposed options are pretty much ok, I am thinking to get it in a 
> way easy for administrators. You can use your patch for now to 
> continue the development. It might be adjusted to give the flags 
> separately, not in module's path, or we go for a solution to hide 
> completely those flags.
>
> Thanks for your update,
> Daniel
>
>
> On 11/24/06 10:38, Bastian Friedrich wrote:
>
>> Hi,
>>
>> Am Mittwoch, 15. November 2006 18:17 schrieb Bastian Friedrich:
>>  
>>
>>> In a nutshell: With RTLD_LOCAL (default behavior on linux), perl 
>>> segfaults.
>>> With RTLD_GLOBAL, t_relay segfaults :((
>>>     
>>
>>
>> I've dug deeper into the topic:
>>
>> * Yes, a shared library that is dlopen'ed and linked against perl needs
>>   RTLD_GLOBAL. See
>>   
>> http://groups.google.com/group/comp.lang.perl.misc/msg/a2877cf7e0c656fe
>> * If all modules but sl.so are loaded with RTLD_GLOBAL, everything is 
>> fine
>> * If sl.so is loaded with RTLD_GLOBAL, a segfault occurs in tm.so's code
>>   (huh???). At least, my gdb says so ;)
>>
>> I was (yet) unable to find the reason for the segfault. Thus, I'd 
>> like to propose some options:
>> * Introduce a flag that lets the user configure whether RTLD_GLOBAL 
>> should be
>>   set. See attached patch: If the user configures
>>   'loadmodule "/my/module.so"', everything stays at it is. By 
>> appending a "G",
>>   RTLD_GLOBAL is configured: 'loadmodule "/my/module.so G"'
>> * Set RTLD_GLOBAL, and fix the segfault... I expect some symbol 
>> collision, but
>>   was unable to locate it :(
>> * Add an optional parameter to load_module(), plus a   | LOADMODULE 
>> STRING COMMA NUMBER
>>   path in the config parser. You'd 'loadmodule "/my/module.so", 1' then.
>> * Best, but a little more difficult: open module regularly. Try to 
>> call a
>>   function "getflags()" or something similar in that module. If it 
>> exists,
>>   close library again and re-open it with the new flags.
>>
>> Looking forward to read about your opinions!
>>
>> Thx,
>>    Bastian
>




More information about the Devel mailing list