From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6286 invoked by alias); 13 Sep 2012 15:11:19 -0000 Received: (qmail 6200 invoked by uid 22791); 13 Sep 2012 15:11:16 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Sep 2012 15:11:01 +0000 From: "astrand at cendio dot se" To: glibc-bugs@sources.redhat.com Subject: [Bug dynamic-link/14577] New: dlopen does not unload failed module - second dlopen succeeds Date: Thu, 13 Sep 2012 15:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: astrand at cendio dot se X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00102.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14577 Bug #: 14577 Summary: dlopen does not unload failed module - second dlopen succeeds Product: glibc Version: 2.12 Status: NEW Severity: normal Priority: P2 Component: dynamic-link AssignedTo: unassigned@sourceware.org ReportedBy: astrand@cendio.se Classification: Unclassified We have a .so file that cannot be loaded on a certain machine, due to missing dependencies. In this case, dlopen() correctly returns NULL. However, the module stays in adress space, and a second dlopen() returns non-NULL. Trying to call functions in the module, however, will result in a segfault. Here's a short test program: #include #include #include /* build: gcc -Wall dlopen.c -ldl -o dlopen run: LD_BIND_NOW=1 ./dlopen ./foo.so */ int main(int argc, char **argv) { void *lib; lib = dlopen(argv[1], RTLD_LAZY); fprintf(stderr, "Lib: %p\n", lib); lib = dlopen(argv[1], RTLD_LAZY); fprintf(stderr, "Lib: %p\n", lib); return 0; } Execution example: $ LD_BIND_NOW=1 ./dlopen ./module-alsa-sink.so Lib: (nil) Lib: 0x1295030 The .so file is admittedly bad since, but it seems strange the dlopen() should report success the second time. Output from ldd: $ ldd -r ./module-alsa-sink.so linux-vdso.so.1 => (0x00007fff8ffff000) libpulsecore-UNKNOWN.UNKNOWN.so => /home/astrand/ctc/client/pulseaudio-new/src/.libs/libpulsecore-UNKNOWN.UNKNOWN.so (0x00007f324db90000) libpulsecommon-UNKNOWN.UNKNOWN.so => /home/astrand/ctc/client/pulseaudio-new/src/.libs/libpulsecommon-UNKNOWN.UNKNOWN.so (0x00007f324d8c2000) libpulse.so.0 => /home/astrand/ctc/client/pulseaudio-new/src/.libs/libpulse.so.0 (0x00007f324d665000) libalsa-util.so => /home/astrand/ctc/client/pulseaudio-new/src/.libs/libalsa-util.so (0x00007f324d420000) libasound.so.2 => /lib64/libasound.so.2 (0x00007f324d120000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f324cf03000) librt.so.1 => /lib64/librt.so.1 (0x00007f324ccfb000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f324caf6000) libm.so.6 => /lib64/libm.so.6 (0x00007f324c872000) libc.so.6 => /lib64/libc.so.6 (0x00007f324c4df000) /lib64/ld-linux-x86-64.so.2 (0x00000035ee800000) symbol snd_pcm_hw_params_can_disable_period_wakeup, version ALSA_0.9 not defined in file libasound.so.2 with link time reference (/home/astrand/ctc/client/pulseaudio-new/src/.libs/libalsa-util.so) symbol snd_pcm_hw_params_set_period_wakeup, version ALSA_0.9 not defined in file libasound.so.2 with link time reference (/home/astrand/ctc/client/pulseaudio-new/src/.libs/libalsa-util.so) symbol snd_pcm_hw_params_get_period_wakeup, version ALSA_0.9 not defined in file libasound.so.2 with link time reference (/home/astrand/ctc/client/pulseaudio-new/src/.libs/libalsa-util.so) The system is a CentOS 6 x86_64 with all updates installed. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.