This is the mail archive of the 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]

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


this is a ping+update for:
	[patch] Fix vDSO l_name for GDB's: Can't read pathname for load map:Input/output error.
	Message-ID: <>

This is a long-term issue: - GDB PR - libc PR -> INVALID GDB workaround #1 GDB workaround #2

Solaris issue but completely unrelated to reasons for this libc/GDB patch:

It is workaroundable in GDB but still I believe it is most easy for consumers
to have readable link map in the first place.  Reading it several times
attempting to incrementally map newly found DSOs in each consumer is ugly.

The new patch tries to address the issue of former version if the string was
located in R/W page which was never been written to.

This condition gets applied for these callers:
      /* Create a link_map for the executable itself.
         This will be what dlopen on "" returns.  */
      main_map = _dl_new_object ((char *) "", "", lt_executable, NULL,
                                 __RTLD_OPENEXEC, LM_ID_BASE);
  struct link_map *l = _dl_new_object ((char *) "", "", lt_library, NULL,
                                       0, LM_ID_BASE);


2013-08-20  Jan Kratochvil  <>

	Fix reading link map from a core file by debugger.
	* elf/dl-object.c (_dl_new_object): Initialize L_NAME from NEWNAME if
	it is empty.

diff --git a/elf/dl-object.c b/elf/dl-object.c
index 0f594d2..e432c46 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -88,7 +88,9 @@ _dl_new_object (char *realname, const char *libname, int type,
   /* newname->next = NULL;	We use calloc therefore not necessary.  */
   newname->dont_free = 1;
-  new->l_name = realname;
+  /* Ensure empty strings from readonly memory are stored in a written page so
+     the string gets dumped into the core file.  */
+  new->l_name = *realname ? realname : newname->name + libname_len - 1;
   new->l_type = type;
   /* If we set the bit now since we know it is never used we avoid
      dirtying the cache line later.  */

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