Re: [PATCH] Skip VDSO when reading SO list

Andreas Arnez
2013-08-20T11:44:25Z

Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> On Mon, 19 Aug 2013 16:44:13 +0200, Andreas Arnez wrote:
>> On some Linux versions, the file name (l_name) of a VDSO's link map
>> entry lies in read-only memory that is excluded from a core dump.
>> When reading such a core dump, GDB complains:
>>
>> warning: Can't read pathname for load map: Input/output error.
>
> I believe the right fix is in glibc instead:
> [patch] Fix vDSO l_name for GDB's: Can't read pathname for load map:Input/output error.
> http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
> Message-ID: <20091004161706.GA27450@host0.dyn.jankratochvil.net>
>
> Could you verify it works for you so that we could possibly ping it?

This patch doesn't apply anymore, because the glibc code has been
restructured, e.g. the vdso logic is now separated out in
elf/setup-vdso.h.

Maybe the following patch would nowadays do the trick.

diff --git a/elf/dl-object.c b/elf/dl-object.c
index 0f594d2..de142de 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -62,6 +62,7 @@ _dl_new_object (char *realname, const char *libname, int type,
size_t libname_len = strlen (libname) + 1;
struct link_map *new;
struct libname_list *newname;
+ static char rw_empty_string[] = { 0 };
#ifdef SHARED
/* We create the map for the executable before we know whether we have
auditing libraries and if yes, how many. Assume the worst. */
@@ -88,7 +89,7 @@ _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;
+ new->l_name = *realname ? realname : rw_empty_string;
new->l_type = type;
/* If we set the bit now since we know it is never used we avoid
dirtying the cache line later. */