This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC][PATCH v1 0/5] 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: Wed, 16 May 2018 18:11:19 +0100
- Subject: [RFC][PATCH v1 0/5] 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.
It is not intended as a final implementation but I wanted to check
that the basic approach is acceptable/workable.
If it is, then I plan to extend the patchset as follows:
- 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.
If it isn't, then I guess it's back to the drawing board (but reasons why
it isn't acceptable/workable would be appreciated so I can figure out how
to do it right).
Vivek Das Mohapatra (5):
bits/dlfcn.h: Declare and describe the dlmopen RTLD_SHARED flag
include/link.h: Update the link_map struct to allow clones
elf/dl-object.c: Implement a helper function to clone link_map entries
elf/dl-load.c, elf-dl-open.c: Implement RTLD_SHARED dlmopen cloning
elf/dl-fini.c: Handle cloned link_map entries in the shutdown path
bits/dlfcn.h | 7 +++++
elf/dl-fini.c | 50 ++++++++++++++++++++++++++++++
elf/dl-load.c | 34 ++++++++++++++++++++
elf/dl-object.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
elf/dl-open.c | 31 +++++++++++++++++--
include/link.h | 6 ++--
sysdeps/generic/ldsodefs.h | 6 ++++
7 files changed, 207 insertions(+), 4 deletions(-)
--
2.11.0