From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 27DE91F461 for ; Wed, 10 Jul 2019 16:21:05 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=hcm7MIgQBrwE7pRp MqA/GEPhyr26QyDxK0ICdi0OzOspZf/j9HwiCnueZwVCYz31UUeNY8OGfOnp2Wf7 oVkfv+a85iD294nWPVvzZyaooo/Vy706E+yIzR6GZsXNSWpOXs4hfRQktNiPPKHN vvoMS/KvnLQs+jQBTNlOZx5zSn4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=wzenanXmbr7m3WlxRM8m4a W0W88=; b=HP2PDbioYvBIoWgQcQ8Tni54FysLObihlqkbzQHde7wKBjy/lMavum Gg/ZhKQMTZPlX7Baxu31HNiRsCtMh3mT8XwN2Xyocvsz7ePGvCXbPf9bm++2N+vt Q3wjfG3ijK13OGCTjVAdGNjnHjHm2VNVhwT6X+QS0BHosHsdrnt4k= Received: (qmail 24540 invoked by alias); 10 Jul 2019 16:21:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 24532 invoked by uid 89); 10 Jul 2019 16:21:02 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-qk1-f179.google.com Subject: Re: dlinfo for the calling shared library To: Florian Weimer , Zack Weinberg Cc: GNU C Library References: <87tvbu7z7g.fsf@oldenburg2.str.redhat.com> From: Carlos O'Donell Message-ID: Date: Wed, 10 Jul 2019 12:20:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <87tvbu7z7g.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 7/10/19 10:15 AM, Florian Weimer wrote: > * Zack Weinberg: > >> Do we have a supported way to make dlinfo() queries for the shared >> library from which the call originates, without the library having to >> know its own soname? (If it knows its own soname, it can call dlopen >> on itself, but I'm looking into a scenario where that information is >> not available.) > > dladdr1 with RTLD_DL_LINKMAP returns the link map, which has a public > l_name member in . If you do not want to use the handle/link > map equivalence, you could dlopen l_name, and that should give you back > the same handle in an official way. What happens if l_name is different on disk now and has a distinct SONAME? Doesn't this introduce a race condition? If you open by SONAME then you should always get the already loaded in-memory object which might have changed from the on-disk contents. -- Cheers, Carlos.