From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 3 23:40:02 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1736ADE for ; Mon, 3 Feb 2014 23:40:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BCF7D146B for ; Mon, 3 Feb 2014 23:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s13Ne1Ic006764 for ; Mon, 3 Feb 2014 23:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s13Ne1Jn006763; Mon, 3 Feb 2014 23:40:01 GMT (envelope-from gnats) Resent-Date: Mon, 3 Feb 2014 23:40:01 GMT Resent-Message-Id: <201402032340.s13Ne1Jn006763@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yuri Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F014AC4 for ; Mon, 3 Feb 2014 23:38:29 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EEEF01452 for ; Mon, 3 Feb 2014 23:38:28 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s13NcS0r021155 for ; Mon, 3 Feb 2014 23:38:28 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s13NcShD021154; Mon, 3 Feb 2014 23:38:28 GMT (envelope-from nobody) Message-Id: <201402032338.s13NcShD021154@oldred.freebsd.org> Date: Mon, 3 Feb 2014 23:38:28 GMT From: Yuri To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/186435: [patch] Allow for an alternative run-time loader X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2014 23:40:02 -0000 >Number: 186435 >Category: misc >Synopsis: [patch] Allow for an alternative run-time loader >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Feb 03 23:40:01 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Yuri >Release: 9.2 >Organization: n/a >Environment: >Description: Synopsys: This is a simple patch to run-time loader, which allows other parts of the process to load objects dynamically. What this patch does: This patch makes r_debug and related symbols in the ld-elf.so.1 run-time loader public. Detailed description: Currently, only r_debug_symbol is public out of all debugger-related symbols in ld-elf.so. This is done so that debuggers can add a breakpoint on it to get notified of changes in the set of loaded shared libraries. This is sufficient when ld-elf.so is the only one who loads objects. Now imagine the situation when an application wants to load its own ELF objects in its own way, still having the benefit of using the debug info. Such application would need to have access to the list of objects maintained by ld-elf.so. r_debug variable contains this list. Such application would necessarily be system specific, and would have to have the knowledge of some inner workings of ld-elf.so. But, in my opinion, this is a legitimate use and should be allowed. Therefore I am suggesting this patch. Except r_debug, it adds related lock object and functions to the list of publics, because they are needed to avoid race conditions. This is, of course, not a mainstream way to do things, but nevertheless it should be allowed. This is also a minor patch, and it can't possibly hurt anything else. --begin patch-- --- libexec/rtld-elf/Symbol.map (revision 260894) +++ libexec/rtld-elf/Symbol.map (working copy) @@ -15,6 +15,11 @@ dlinfo; dl_iterate_phdr; r_debug_state; + r_debug; + rtld_bind_lock; + rlock_acquire; + wlock_acquire; + lock_release; __tls_get_addr; }; --end patch-- >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: