Bug 286571 - doesn't see symbols from (some?) dsos
Summary: doesn't see symbols from (some?) dsos
Alias: None
Product: Fedora
Classification: Fedora
Component: valgrind
Version: 8
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
Whiteboard: bzcl34nup
Depends On:
TreeView+ depends on / blocked
Reported: 2007-09-11 18:19 UTC by Matthias Clasen
Modified: 2009-01-09 04:53 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-01-09 04:53:23 UTC
Type: ---

Attachments (Terms of Use)
valgrind log (10.32 KB, application/octet-stream)
2007-09-11 18:43 UTC, Matthias Clasen
no flags Details

Description Matthias Clasen 2007-09-11 18:19:35 UTC
I am seeing a problem here, using valgrind with current rawhide. 

It gives me stacktraces like the following for leaks in the gconf daemon:

==10600== 16 bytes in 2 blocks are definitely lost in loss record 161 of 586
==10600==    at 0x4022525: malloc (vg_replace_malloc.c:149)
==10600==    by 0x4158A15: g_malloc (gmem.c:131)
==10600==    by 0x416D6FA: g_slice_alloc (gslice.c:824)
==10600==    by 0x416E921: g_slist_prepend (gslist.c:91)
==10600==    by 0x402BB0E: ???
==10600==    by 0x402EB6D: ???
==10600==    by 0x402ECAD: ???
==10600==    by 0x402EE5A: ???
==10600==    by 0x4029526: ???
==10600==    by 0x40298E6: ???
==10600==    by 0x4053534: gconf_source_query_value (gconf-sources.c:125)
==10600==    by 0x40545D9: gconf_sources_query_value (gconf-sources.c:553)
==10600==    by 0x4054B6F: hash_lookup_defaults_func (gconf-sources.c:1190)
==10600==    by 0x4143FC5: g_hash_table_foreach (ghash.c:680)
==10600==    by 0x4053E87: gconf_sources_all_entries (gconf-sources.c:1393)
==10600==    by 0x804BD35: gconf_database_all_entries (gconf-database.c:1617)
==10600==    by 0x804D91F: impl_ConfigDatabase2_all_entries_with_schema_name

As you can see, it doesn't find the debuginfo for the backend, which is a
dlopened module.

I checked the debuginfo package, and it does include the necessary files. 

gdb does not have this problem.

I wonder if this could possibly be related to the build id changes in rawhide.
(this is with current rawhide)

Comment 1 Roland McGrath 2007-09-11 18:29:57 UTC
Please try valgrind with -vvv.

This report does not say how to reproduce the bug.

Comment 2 Matthias Clasen 2007-09-11 18:42:38 UTC
I'm attaching the output of a manual run of

valgrind -v --leak-check=yes /usr/libexec/gconfd-2 

I did a gconftool-2 -R /desktop/gnome to excercise some backend code, before I
killed gconfd.

The interesting bit seems to be

--30986-- Reading syms from /usr/lib/GConf/2/libgconfbackend-xml.so (0x4026000)
--30986-- Reading debug info from
--30986-- REDIR: 0x4015CA0 (stpcpy) redirected to 0x40244D0 (stpcpy)
--30986-- Discarding syms at 0x4026000-0x4034000 in
/usr/lib/GConf/2/libgconfbackend-xml.so due to munmap()

But I don't really know what it means. Who did the munmap ?

Comment 3 Matthias Clasen 2007-09-11 18:43:11 UTC
Created attachment 192851 [details]
valgrind log

Comment 4 Roland McGrath 2007-09-11 19:38:46 UTC
munmap of the DSO address range should be done only by dlclose.
Try the LD_DEBUG=files environment variable to see if the DSO is really being
closed.  If not, valgrind may be confused.  If your application dlclose's as a
matter of course, then by the time you are at the end of the run it is true and
proper that those PC addresses are no longer mapped to the DSO.  So I suspect
all that's happening is that you have memory leaks in the DSOs that get unloaded
during the run.

One can imagine a couple of things valgrind could do to help you track these
down.  One way would be to keep around the debuginfo/symbols for a DSO after
it's unmapped, until that address is mmap'd for something new.  Then it could
still translate those stale addresses, and print ("in unloaded DSO foobar.so")
when describing them.

Another idea is one that might help find some bugs quicker.  That is, an option
to keep track of PC addresses used in allocation record backtraces for live
allocations as "in use".  Then, when munmap'ing code pages, it could check the
address range against all such PCs in use.  Then at the time of the dlclose it
would report "caller of live allocated block being unloaded".  Such cases are
not always errors, though.

As to a workaround to find your bug, you could try tweaking your application so
it does not dlclose anything.  Then you would have symbolic information for
those leak reports.  A simple hack to do this for debugging is to collect the
list of dlopen'd DSOs in your run, and insert an extra dlopen call for each;
that will keep a ref alive so the normal dlclose is actually a no-op.

Comment 5 Bug Zapper 2008-04-04 13:49:13 UTC
Based on the date this bug was created, it appears to have been reported
during the development of Fedora 8. In order to refocus our efforts as
a project we are changing the version of this bug to '8'.

If this bug still exists in rawhide, please change the version back to
(If you're unable to change the bug's version, add a comment to the bug
and someone will change it for you.)

Thanks for your help and we apologize for the interruption.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 6 Bug Zapper 2008-11-26 07:47:03 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is 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 please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

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: 

Comment 7 Bug Zapper 2009-01-09 04:53:23 UTC
Fedora 8 changed to end-of-life (EOL) status on 2009-01-07. Fedora 8 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.