This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add RTLD_RELOAD to dlopen


On 07/20/2017 03:15 PM, Samuel Thibault wrote:
> Hello,
> 
> In our parallel programming projects, we would like to load some DSO
> several times within the same process, because we want to share the
> addresse space for passing data pointers between parallel executions,
> and the DSO has global variables and such which we want to see
> duplicated.
> 
> Unfortunately, dlopen() does not re-load the DSO when it is already
> loaded. One workaround is to cp the file under another name, but that's
> ugly and does not share the memory pages.
> 
> The patch proposed here simply adds an RTLD_RELOAD flag which disables
> checking for the DSO being already loaded, thus always loading the DSO
> again. There is no actual code modification, only the addition of two
> if()s and reindent.
 
This is what Solaris designed dlmopen() for, is there any reason you
can't use dlmopen()?

I have a branch with fixes for dlmopen() which finish implementing the
missing pieces that we need e.g. carlos/dlmopen.

I strongly suggest dlmopen() as the way to solve this problem, particularly
since dlmopen() offers much stronger isolation, and ensures that the globals
get the correct binding and don't escape the namespace and accidentally
resolve to the first definition by the first opened library.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]