libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libunwind] bug in get_list_addr()


From: David Mosberger
Subject: Re: [libunwind] bug in get_list_addr()
Date: Thu, 21 Oct 2004 07:09:36 -0700

>>>>> On Tue, 19 Oct 2004 15:04:35 -0500 (CDT), Todd L Miller <address@hidden> 
>>>>> said:

  Todd>         In get_list_addr()
  Todd> (ptrace/_UPT_get_dyn_info_list_addr.c), libunwind appears to
  Todd> assume that /proc/*/maps contains only filenames or empty
  Todd> strings in its last column.  However, if a shared memory
  Todd> segment has been established in the remote process, this entry
  Todd> contains strings like "/SYSV00001b58", sometimes with a
  Todd> trailing "(deleted)".  These strings, of course, can't be
  Todd> mapped by elf_map_image(); however, get_list_addr() returns
  Todd> -UNW_ENOINFO when this mapping fails, even if it has
  Todd> previously located a dynamic unwind informat list address.
  Todd> Looking at the code, I can't find any reason for it not so
  Todd> simply continue;, and patching it to do so seems to solve the
  Todd> problem.  (On or around line 62.)  Let me know if you need any
  Todd> more information to (commit a) fix (for) this.

Yes, this sounds entirely correct.  Can you confirm that the attached
patch fixes the problem?  (It's already in the bk repository.)

Thanks,

        --david

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/21 16:06:28+02:00 address@hidden 
#   Fix _UPT_get_dyn_info_list_addr() so it doesn't fail just because
#   a /proc/PID/maps file contains a mapping of something other than
#   a regular file.  Reported and fix proposed by Todd L. Miller.
# 
# src/ptrace/_UPT_get_dyn_info_list_addr.c
#   2004/10/21 16:06:28+02:00 address@hidden +2 -4
#   (get_list_addr): Don't fail with -UNW_ENOINFO just because something
#       in /proc/maps isn't mappable.
# 
diff -Nru a/src/ptrace/_UPT_get_dyn_info_list_addr.c 
b/src/ptrace/_UPT_get_dyn_info_list_addr.c
--- a/src/ptrace/_UPT_get_dyn_info_list_addr.c  2004-10-21 07:08:20 -07:00
+++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c  2004-10-21 07:08:20 -07:00
@@ -55,10 +55,8 @@
        }
 
       if (elf_map_image (&ui->ei, path) < 0)
-       {
-         maps_close (&mi);
-         return -UNW_ENOINFO;
-       }
+       /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
+       continue;
 
       Debug (16, "checking object %s\n", path);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]