From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18994 invoked by alias); 5 Apr 2018 17:52:41 -0000 Mailing-List: contact libc-help-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: libc-help-owner@sourceware.org Received: (qmail 18888 invoked by uid 89); 5 Apr 2018 17:52:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=shutdown, thin, HContent-Transfer-Encoding:8bit X-HELO: bhuna.collabora.co.uk Received: from bhuna.collabora.co.uk (HELO bhuna.collabora.co.uk) (46.235.227.227) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Apr 2018 17:52:39 +0000 Received: from noise.collabora.co.uk (unknown [IPv6:2a00:5f00:102:0:21e1:4ee1:a25:9887]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7D5A9271144 for ; Thu, 5 Apr 2018 18:52:37 +0100 (BST) From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= To: libc-help@sourceware.org Subject: [RFC PATCH 0/5] Proof-of-Concept implementation of RTLD_SHARED for dlmopen Date: Thu, 05 Apr 2018 17:52:00 -0000 Message-Id: <20180405175231.14757-1-vivek@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-04/txt/msg00004.txt.bz2 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 | 51 ++++++++++++++++++++++++++++++ elf/dl-load.c | 34 ++++++++++++++++++++ elf/dl-object.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ elf/dl-open.c | 31 ++++++++++++++++-- include/link.h | 6 ++-- sysdeps/generic/ldsodefs.h | 6 ++++ 7 files changed, 209 insertions(+), 4 deletions(-) -- 2.11.0