This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix vDSO l_name for GDB's: Can't read pathname for load map:Input/output error.


Hi,

GDB currently always prints on loading a core file:
	warning: Can't read pathname for load map: Input/output error.

The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name,
this fix is for vDSO l_name.

The patch hunk 2 is for ld-linux.so.2 l_name and it is not used by current GDB
as it always ignores the first DSO list entry; it can be even dropped.

Regression tested on {x86_86,i686,ppc{,64}}-fedora12-linux-gnu.


Thanks,
Jan


2009-10-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix reading DSO list from a core file by debugger.
	* elf/rtld.c (dl_main): New variable char_zero.
	(dl_main <*user_entry != (ElfW(Addr)) ENTRY_POINT>)
	(dl_main <GLRO(dl_sysinfo_dso) != NULL>): Call _dl_new_object with
	&char_zero.

--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -899,6 +899,7 @@ dl_main (const ElfW(Phdr) *phdr,
   hp_timing_t diff;
 #endif
   void *tcbp = NULL;
+  static char char_zero = 0;
 
 #ifdef _LIBC_REENTRANT
   /* Explicit initialization since the reloc would just be more work.  */
@@ -1086,8 +1087,11 @@ of this helper program; chances are you did not intend to run this program.\n\
   else
     {
       /* Create a link_map for the executable itself.
-	 This will be what dlopen on "" returns.  */
-      main_map = _dl_new_object ((char *) "", "", lt_executable, NULL,
+	 This will be what dlopen on "" returns.
+
+	 The memory pointed to by l_name should be accessible also from the
+	 dumped core files where shared readonly segments are not present.  */
+      main_map = _dl_new_object (&char_zero, "", lt_executable, NULL,
 				 __RTLD_OPENEXEC, LM_ID_BASE);
       assert (main_map != NULL);
       assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
@@ -1297,8 +1301,13 @@ of this helper program; chances are you did not intend to run this program.\n\
 	 to map in the object.  It's already mapped and prelinked (and
 	 better be, since it's read-only and so we couldn't relocate it).
 	 We just want our data structures to describe it as if we had just
-	 mapped and relocated it normally.  */
-      struct link_map *l = _dl_new_object ((char *) "", "", lt_library, NULL,
+	 mapped and relocated it normally.
+
+	 The memory pointed to by l_name should be accessible also from the
+	 dumped core files where shared readonly segments are not present.
+	 The real system-supplied DSO's DT_SONAME is not suitable as any
+	 non-empty filename in l_name should be accessible on the disk.  */
+      struct link_map *l = _dl_new_object (&char_zero, "", lt_library, NULL,
 					   0, LM_ID_BASE);
       if (__builtin_expect (l != NULL, 1))
 	{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]