This is the mail archive of the
mailing list for the glibc project.
[RFC][PATCH v3 0/6] Proof-of-Concept implementation of RTLD_SHARED for dlmopen
- From: Vivek Das Mohapatra <vivek at collabora dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 20 Aug 2018 14:54:25 +0100
- Subject: [RFC][PATCH v3 0/6] Proof-of-Concept implementation of RTLD_SHARED for dlmopen
As discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=22745
dlmopen requires a mechanism for [optionally] sharing some objects
between more than one namespace.
The following patchset attempts an implementation for this: If an object
is loaded with the new RTLD_SHARED flag we instead ensure that a "master"
copy exists (and is flagged as no-delete) in the main namespace and a
thin wrapper or clone is placed in the target namespace.
I have attached the test program(s) I am using to the bug above.
This patch series should address all the comments received on the earlier
(v1) series, and fixes a bug in the previous (v2) series which left the
r_debug struct in an inconsistent state when creating a proxy triggered
the initial load of a DSO into the main namespace.
If this is acceptable then I will get to work on a second patch series
extending this one, which will aim to achieve the following:
- dlmopen will implicitly apply RTLD_SHARED to the libc/libpthread group
- The user will be able to request that this sharing _not_ occur
by passing a different flag to dlmopen (name TBD)
- LD_AUDIT paths will not apply this implict sharing rule, so audit libraries
will continue to be completely isolated.
And further (probably in another series to keep the changes manageable):
- Implement RTLD_GLOBAL support for namespaces (ie RTLD_GLOBAL will mean
"this DSO should be used for all symbol resolution in _this_ namespace")
Vivek Das Mohapatra (6):
Declare and describe the dlmopen RTLD_SHARED flag
include/link.h: Update the link_map struct to allow proxies
elf/dl-object.c: Implement a helper function to proxy link_map entries
elf/dl-load.c, elf-dl-open.c: Implement RTLD_SHARED dlmopen proxying
elf/dl-fini.c: Handle proxy link_map entries in the shutdown path
elf/dl-init.c: Skip proxied link map entries in the dl init path
bits/dlfcn.h | 7 ++++
elf/dl-close.c | 43 +++++++++++++----------
elf/dl-fini.c | 6 ++--
elf/dl-init.c | 4 +--
elf/dl-load.c | 45 ++++++++++++++++++++++++
elf/dl-object.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++
elf/dl-open.c | 50 +++++++++++++++++++++++++--
include/link.h | 6 ++--
sysdeps/generic/ldsodefs.h | 5 +++
sysdeps/mips/bits/dlfcn.h | 7 ++++
10 files changed, 233 insertions(+), 25 deletions(-)