My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 12: chronicle-query: readMem requests for memory areas in shared libraries without debug info return wrong data
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by pmaydell, Dec 20, 2008
If you ask chronicle-query for the contents of memory in an area which
corresponds to an mmap()ed shared library, where there isn't any debug info
for that library, ie where on startup chronicle-query complained 

{"message":"debug.file.no.debug.info","severity":"info","text":"Executable
file '/lib/tls/i686/cmov/libc-2.8.90.so' does not have debug
info","errno":2,"errnotext":"error 2 received, unmappable by strerror"}

then chronicle-query will return incorrect data in its response.

This is because load_all_mmapped_objects opens the shared library and fills
in obj->fd with the fd number, but it then calls load_dwarf2_for() which in
turn calls dwarf2_load(), which will close the fd if there is no debug info
present. obj->fd is never updated, so when we come to try to satisfy the
read request we read data from whatever happens to be on the fd at the time
(usually the next library we opened successfully).

I'm attaching a fairly small patch which fixes this for me. You might
prefer a more general restructuring of your code to avoid having APIs where
you pass an open fd into a function and it closes it inside the function.

chronicle-query.patch.txt
2.2 KB Download
Comment 1 by pmaydell, Oct 11, 2009
It turns out that my original patch wasn't quite right. In the case on Ubuntu where
the debug information is in the /usr/lib/debug version of the shared object, we need
to retain both filedescriptors -- one to satisfy memory read/write requests, and one
to read the debug information from. I'm attaching a fixed patch...

chronicle-query.fixed.patch.txt
3.9 KB Download
Sign in to add a comment

Hosted by Google Code