From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22890 invoked by alias); 21 Jun 2019 11:53:18 -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 22879 invoked by uid 89); 21 Jun 2019 11:53:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*Ad:U*libc-help, segfaults X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jun 2019 11:53:16 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E030D30842A0; Fri, 21 Jun 2019 11:53:14 +0000 (UTC) Received: from oldenburg2.str.redhat.com (dhcp-192-180.str.redhat.com [10.33.192.180]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 497AE1001B0F; Fri, 21 Jun 2019 11:53:14 +0000 (UTC) From: Florian Weimer To: Baojun Wang Cc: libc-help@sourceware.org Subject: Re: dlmopen in LD_PRELOAD References: <871rzsdpj5.fsf@oldenburg2.str.redhat.com> <87sgs8c9x7.fsf@oldenburg2.str.redhat.com> Date: Fri, 21 Jun 2019 11:53:00 -0000 In-Reply-To: (Baojun Wang's message of "Tue, 18 Jun 2019 00:14:53 -0400") Message-ID: <87a7ebxihi.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00036.txt.bz2 * Baojun Wang: > Hi Florian, > > (re-send because previous email failed to send due to attachment) > > I made a tiny project this issue, it didn't show the same failure, however it did segfaults inside the library being `dlmopen`-ed. > > link: `git clone https://github.com/wangbj/dlns-test.git` > (sorry attachment seems to cause failure to send message) > > run.c: an launcher to inject DSOs. > preload.c: a mini loader using LD_PRELOAD -> dlmopen > dlns.c: DSO being `dlmopen`-ed > app.c: app being injected with DSOs. > > running `make test` should reproduce the issue. (need to run `ulimit > -c unlimited` to get core dump). Sorry, for me, it does not. This is the output I get: ./run libpreload.so libdlns.so ./app open /tmp/dlns-test/libdlns.so dlns_init [link_map] dso: /tmp/dlns-test/libdlns.so, loaded at: 0x7f0ca0d53000, _DYNAMIC: 0x7f0ca0d56de8 [link_map] dso: /lib64/libdl.so.2, loaded at: 0x7f0ca0d4d000, _DYNAMIC: 0x7f0ca0d51d70 [link_map] dso: /lib64/libpthread.so.0, loaded at: 0x7f0ca0b12000, _DYNAMIC: 0x7f0ca0b2dd60 [link_map] dso: /lib64/libc.so.6, loaded at: 0x7f0ca094c000, _DYNAMIC: 0x7f0ca0b0bb60 [link_map] dso: /lib64/ld-linux-x86-64.so.2, loaded at: (nil), _DYNAMIC: (nil) #1 local_getpid addr = 0x401610 #0 local_getpid addr = 0x401610 #2 local_getpid addr = 0x401610 #3 local_getpid addr = 0x401610 #1 local_getpid: 0 #1 local_getpid: 0 #1 my own tls: 1234 #2 local_getpid: 0 #2 local_getpid: 0 #3 local_getpid: 0 #3 local_getpid: 0 #3 my own tls: 1234 #2 my own tls: 1234 #0 local_getpid: 0 #0 local_getpid: 0 #0 my own tls: 1234 Has your glibc been built with --enable-bind-now? Thanks, Florian