Message ID | 20210708163255.812-1-vivek@collabora.com |
---|---|
Headers | show |
Series | Implementation of RTLD_SHARED for dlmopen | expand |
These patches + https://patchwork.sourceware.org/project/glibc/patch/20200626193228.1953-2-danielwa@cisco.com/ allow to spawn several isolated JVMs within the same process, each one with its own isolated set of native libraries, including the Linux graphical stack, something that wasn't possible before. The JVM exercises MANY corner cases with its native libraries; we managed to run NetBeans, jEdit, MochaDoom, kotNES... (all graphical applications) inside isolated namespaces, something we've been struggling for years and finally we see some light. This is a huge milestone, if such complex applications can run, most likely everything else will just work. We look forward to integrating these patches to make dlmopen fully usable and bug-free. Best, Alfonso²
On 08/07/2021 13:32, Vivek Das Mohapatra via Libc-alpha wrote: > This is a revision of a previous patchset that I posted here > regarding https://sourceware.org/bugzilla/show_bug.cgi?id=22745 > > Introduction: > > ======================================================================= > As discussed in the URL above dlmopen requires a mechanism for > [optionally] sharing some objects between more than one namespace. > > The following patchset provides 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. > > This patch series should address all the comments received on the > earlier (v1-v10) series. > > ======================================================================= > > Changes from v11: > > - If a DSO is required in a non-base namespace because it is mentioned > in a DT_NEEDED entry and it is itself flagged DF_GNU_1_UNIQUE then > a proxy is generated for it. > > - Relocations via non-base namespace proxies work reliably (some code > paths did not do the address calculation relative to the DSO base > correctly when a proxy was involved). > > - Tests extended cover the above two scenarios. > > Changes from v10: > > - A segfault in a dlmopen error pathway (which does not seem to have existed > when v10 was applied to the then-HEAD commit) has been fixed. > > - The fallback mechanism for adding DT_GNU_FLAGS_1 sections to the required > binaries has had some infrastructure moved to the elf/ directory > > - The runstatedir setting introduced by recent autoconf has been omitted from > the patchset as it is not relevant to this feature. > > - libpthread no longer tagged DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE. > (with both -z unique supporting linkers and if the .os hack is > used to add the new flag - this was inconsistent before). > > Not changed: > > - There is still some diagnostic info in the config.log when the linker > layout is acceptable but -z unique is not yet supported. I believe this > _is_ useful diagnostic information as a developer might otherwise wonder > why the vanilla linker was being rejected when its layout output seemed > fine. > > I have not yet implemented, but plan to address once this series is > accepted/acceptable: > > - dl_iterate_ns_phdr (cf dl_iterate_phdr but taking a namespace argument) > > - Check RTLD_GLOBAL interacts properly and unsurprisingly with RTLD_SHARED. Hi Vivek, This patchset looks much better than before, I have added my comments on the set. There are some spots that need rework, like some patches that should be merged, some style fixes, and testcase; but in general I think we can move forward. I have fixed all my remarks on a personal branch [1] and checked on both x86_64-linux-gnu and i686-linux-gnu with binutils with and without DT_GNU_FLAGS_1 support. If you are ok with my changes, please report the patches without the RFC so I can ack them and I will push them upstream. Thanks for working on this. [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/rtld-shared