Message ID | 20180516171124.24962-2-vivek@collabora.com |
---|---|
State | New |
Headers | show |
Series | Proof-of-Concept implementation of RTLD_SHARED for dlmopen | expand |
On 05/16/2018 01:11 PM, Vivek Das Mohapatra wrote: > From: Vivek Das Mohapatra <vivek@collabora.co.uk> > > This flag will instruct dlmopen to create a shared object present > in both the main namespace and the selected namespace when set. > --- > bits/dlfcn.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/bits/dlfcn.h b/bits/dlfcn.h > index b0b129b66b..a96270d499 100644 > --- a/bits/dlfcn.h > +++ b/bits/dlfcn.h > @@ -32,6 +32,13 @@ > visible as if the object were linked directly into the program. */ > #define RTLD_GLOBAL 0x00100 > > +/* If the following bit is set in the MODE argument to dlmopen > + then the target object is loaded into the main namespace (if > + it is not already there) and a shallow copy (clone) is placed > + in the target namespace: This allows multiple namespaces to > + share a single instance of a DSO. */ > +#define RTLD_SHARED 0x00080 This is an RFC, but also note there is a MIPS-specific dlfcn.h which needs patching also to define RTLD_SHARED. We should probably try to look at how the constants overlap, and find a common value to start with for everyone. I agree that we need a constant with which to choose between: * Old dlmopen behaviour. * New dlmopen behaviour. > + > /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. > The implementation does this by default and so we can define the > value to zero. */ >
>> +#define RTLD_SHARED 0x00080 > > This is an RFC, but also note there is a MIPS-specific dlfcn.h which needs > patching also to define RTLD_SHARED. We should probably try to look at how > the constants overlap, and find a common value to start with for everyone. Noted. > I agree that we need a constant with which to choose between: > > * Old dlmopen behaviour. > * New dlmopen behaviour. My plan is to put that in the "policy" patchset once this "mechanism" patchset is acceptable: Something like: RTLD_SHARED - this library and its dependencies will be proxied RTLD_ISOLATED - nothing (except ld.so) will be proxied (we hope you know what you're doing) aka the old behaviour -nothing- - libc/libpthread/ld.so will be proxied from the main ns. everything else will be isolated. Details to be thrashed out later.
diff --git a/bits/dlfcn.h b/bits/dlfcn.h index b0b129b66b..a96270d499 100644 --- a/bits/dlfcn.h +++ b/bits/dlfcn.h @@ -32,6 +32,13 @@ visible as if the object were linked directly into the program. */ #define RTLD_GLOBAL 0x00100 +/* If the following bit is set in the MODE argument to dlmopen + then the target object is loaded into the main namespace (if + it is not already there) and a shallow copy (clone) is placed + in the target namespace: This allows multiple namespaces to + share a single instance of a DSO. */ +#define RTLD_SHARED 0x00080 + /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. The implementation does this by default and so we can define the value to zero. */
From: Vivek Das Mohapatra <vivek@collabora.co.uk> This flag will instruct dlmopen to create a shared object present in both the main namespace and the selected namespace when set. --- bits/dlfcn.h | 7 +++++++ 1 file changed, 7 insertions(+)