Bug 698231

Summary: can valgrind handle dlopen()?
Product: [Fedora] Fedora Reporter: Milos Jakubicek <xjakub>
Component: valgrindAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: dodji, jakub, mjw
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-16 13:28:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Milos Jakubicek 2011-04-20 13:39:03 UTC
Description of problem:

If I try just opening and closing a library by the following code:

#include <dlfcn.h>
int main () {
    void *handle = dlopen("./libPlugin.so.0.0.0", RTLD_LAZY);
    dlclose(handle);
}

libPlugin.so.0.0.0 was compiled by 

gcc -g -O0 -fPIC -DPIC -Wall -pipe -fexceptions -fstack-protector -Wp,-D_FORTIFY_SOURCE=2 -shared -Wl,-soname,libPlugin.so.0 -o libPlugin.so.0.0.0 plugin.c

where plugin.c contains some code, or might be even empty.

I get:

==21421== HEAP SUMMARY:
==21421==     in use at exit: 9,031 bytes in 16 blocks
==21421==   total heap usage: 34 allocs, 18 frees, 15,358 bytes allocated
==21421== 
==21421== 64 bytes in 3 blocks are still reachable in loss record 1 of 6
==21421==    at 0x4A05E46: malloc (vg_replace_malloc.c:195)
==21421==    by 0x38EC207BBA: _dl_map_object (dl-load.c:162)
==21421==    by 0x38EC20BD01: openaux (dl-deps.c:65)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC20C402: _dl_map_object_deps (dl-deps.c:247)
==21421==    by 0x38EC211E03: dl_open_worker (dl-open.c:263)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC212449: _dl_open (dl-open.c:555)
==21421==    by 0x38ECE00F15: dlopen_doit (dlopen.c:67)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38ECE0152B: _dlerror_run (dlerror.c:164)
==21421==    by 0x38ECE00FC0: dlopen@@GLIBC_2.2.5 (dlopen.c:88)
==21421== 
==21421== 64 bytes in 3 blocks are still reachable in loss record 2 of 6
==21421==    at 0x4A05E46: malloc (vg_replace_malloc.c:195)
==21421==    by 0x38EC20A931: _dl_new_object (dl-object.c:161)
==21421==    by 0x38EC205DBD: _dl_map_object_from_fd (dl-load.c:957)
==21421==    by 0x38EC207996: _dl_map_object (dl-load.c:2246)
==21421==    by 0x38EC20BD01: openaux (dl-deps.c:65)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC20C402: _dl_map_object_deps (dl-deps.c:247)
==21421==    by 0x38EC211E03: dl_open_worker (dl-open.c:263)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC212449: _dl_open (dl-open.c:555)
==21421==    by 0x38ECE00F15: dlopen_doit (dlopen.c:67)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421== 
==21421== 96 bytes in 3 blocks are still reachable in loss record 3 of 6
==21421==    at 0x4A05E46: malloc (vg_replace_malloc.c:195)
==21421==    by 0x38EC2138B4: _dl_close_worker (dl-close.c:375)
==21421==    by 0x38EC213D4B: _dl_close (dl-close.c:754)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38ECE0152B: _dlerror_run (dlerror.c:164)
==21421==    by 0x38ECE0100E: dlclose (dlclose.c:48)
==21421==    by 0x4005F3: main (in /home/milos/muni/nlp/synt/git/synt/dlopen)
==21421== 
==21421== 1,224 bytes in 3 blocks are still reachable in loss record 4 of 6
==21421==    at 0x4A04896: calloc (vg_replace_malloc.c:418)
==21421==    by 0x38EC20F553: _dl_check_map_versions (dl-version.c:300)
==21421==    by 0x38EC212058: dl_open_worker (dl-open.c:269)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC212449: _dl_open (dl-open.c:555)
==21421==    by 0x38ECE00F15: dlopen_doit (dlopen.c:67)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38ECE0152B: _dlerror_run (dlerror.c:164)
==21421==    by 0x38ECE00FC0: dlopen@@GLIBC_2.2.5 (dlopen.c:88)
==21421==    by 0x4005CA: main (in /home/milos/muni/nlp/synt/git/synt/dlopen)
==21421== 
==21421== 3,519 bytes in 3 blocks are still reachable in loss record 5 of 6
==21421==    at 0x4A04896: calloc (vg_replace_malloc.c:418)
==21421==    by 0x38EC20A69E: _dl_new_object (dl-object.c:77)
==21421==    by 0x38EC205DBD: _dl_map_object_from_fd (dl-load.c:957)
==21421==    by 0x38EC207996: _dl_map_object (dl-load.c:2246)
==21421==    by 0x38EC20BD01: openaux (dl-deps.c:65)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC20C402: _dl_map_object_deps (dl-deps.c:247)
==21421==    by 0x38EC211E03: dl_open_worker (dl-open.c:263)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC212449: _dl_open (dl-open.c:555)
==21421==    by 0x38ECE00F15: dlopen_doit (dlopen.c:67)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421== 
==21421== 4,064 bytes in 1 blocks are still reachable in loss record 6 of 6
==21421==    at 0x4A04896: calloc (vg_replace_malloc.c:418)
==21421==    by 0x38EC209082: do_lookup_x (dl-lookup.c:390)
==21421==    by 0x38EC2096A1: _dl_lookup_symbol_x (dl-lookup.c:736)
==21421==    by 0x38EC20AFED: _dl_relocate_object (dl-machine.h:295)
==21421==    by 0x38EC211ED5: dl_open_worker (dl-open.c:339)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38EC212449: _dl_open (dl-open.c:555)
==21421==    by 0x38ECE00F15: dlopen_doit (dlopen.c:67)
==21421==    by 0x38EC20DC65: _dl_catch_error (dl-error.c:178)
==21421==    by 0x38ECE0152B: _dlerror_run (dlerror.c:164)
==21421==    by 0x38ECE00FC0: dlopen@@GLIBC_2.2.5 (dlopen.c:88)
==21421==    by 0x4005CA: main (in /home/milos/muni/nlp/synt/git/synt/dlopen)
==21421== 
==21421== LEAK SUMMARY:
==21421==    definitely lost: 0 bytes in 0 blocks
==21421==    indirectly lost: 0 bytes in 0 blocks
==21421==      possibly lost: 0 bytes in 0 blocks
==21421==    still reachable: 9,031 bytes in 16 blocks
==21421==         suppressed: 0 bytes in 0 blocks
==21421== 
==21421== For counts of detected and suppressed errors, rerun with: -v
==21421== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)

Version-Release number of selected component (if applicable):

valgrind-3.5.0-20.fc14.x86_64

Comment 1 Fedora End Of Life 2012-08-16 13:28:52 UTC
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Mark Wielaard 2012-08-18 14:31:23 UTC
Couldn't replicate with valgrind 3.6.0 or higher.