From: Pedro Alves <palves@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch+7.5.1] Work around PR libc/13097 "linux-vdso.so.1" #3
Date: Fri, 23 Nov 2012 18:19:00 -0000 [thread overview]
Message-ID: <50AFBE11.2050908@redhat.com> (raw)
In-Reply-To: <CAMe9rOoKhuQssSBhjNfM86Fk_wrs-WnqJG0TJs2gkDmrnaynrQ@mail.gmail.com>
On 11/23/2012 04:30 PM, H.J. Lu wrote:
> On Thu, Nov 22, 2012 at 12:17 PM, Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
>> Hi,
>>
>> this is an updated version of
>> [RFC] Work around PR libc/13097 "linux-vdso.so.1" #2
>> http://sourceware.org/ml/gdb-patches/2011-08/msg00331.html
>> according to the Tom's comment
>> http://sourceware.org/bugzilla/show_bug.cgi?id=14466#c3
>>
>> I remembered it when Joel plans 7.5.1 release, the patch is safe enough and it
>> is a FAQ at least on IRC.
>>
>> Fedora does not have this issue with its Fedora glibc but I have it
>> reproducible with FSF glibc build:
>> ./gdb -ex r --args $HOME/glibc-root/lib/ld-linux-x86-64.so.2 --library-path $HOME/glibc-root/lib /bin/true
>> Starting program: /home/.../glibc-root/lib/ld-linux-x86-64.so.2 --library-path /home/.../glibc-root/lib /bin/true
>> warning: Could not load shared library symbols for linux-vdso.so.1.
>> Do you need "set solib-search-path" or "set sysroot"?
>> [Inferior 1 (process 31807) exited normally]
>>
>> So there is no testcase as I do not know a real OS where it fails (it probably
>> fails on Ubuntu AFAIK).
>>
>> No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.
>>
>>
>
> vdso is available from /proc:
>
> #include <stdio.h>
> #include <string.h>
>
> int
> main()
> {
> FILE *maps;
> void *vdso_begin, *vdso_end;
>
> maps = fopen("/proc/self/maps", "r");
> char buf[1024];
> while (fgets(buf, 1024, maps)) {
> if (strstr(buf, "[vdso]")) break;
> }
> fclose(maps);
>
> sscanf(buf, "%p-%p", &vdso_begin, &vdso_end);
> write(1, vdso_begin, vdso_end - vdso_begin);
It's found in AT_SYSINFO_EHDR too.
Alternatively to hard coding the names, maybe we could match the vdso address
found through that with the addresses found iterating the dynamic linker list, to
know which dynamic linker entry is the vdso.
> extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *,
> size_t, void *),
> void *__data);
This is basically what GDB does, manually. The issue is knowing _which_ of
the DSOs is the vdso, and therefore not finding a file on the file system with
that name should be okay.
> Can GDB use them to locate vdso?
--
Pedro Alves
next prev parent reply other threads:[~2012-11-23 18:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 20:17 Jan Kratochvil
2012-11-23 11:30 ` Luis Gustavo
2012-11-23 11:41 ` Jan Kratochvil
2012-11-23 11:59 ` Luis Machado
2012-11-23 12:03 ` Pedro Alves
2012-11-23 12:40 ` Jan Kratochvil
2012-11-23 14:05 ` Luis Machado
2012-11-23 14:07 ` Jan Kratochvil
2012-11-23 16:01 ` Pedro Alves
2012-11-23 16:12 ` Mark Kettenis
2012-11-23 16:17 ` Jan Kratochvil
2012-11-23 16:23 ` Pedro Alves
2012-11-23 17:28 ` Joel Brobecker
2012-11-23 18:17 ` Jan Kratochvil
2012-11-23 18:22 ` Pedro Alves
2012-11-27 21:58 ` Mike Frysinger
2012-11-27 23:00 ` Matt Rice
2012-11-28 1:12 ` Pedro Alves
2012-11-28 20:39 ` Mike Frysinger
2012-11-28 22:44 ` Jan Kratochvil
2012-11-29 1:07 ` Mike Frysinger
2012-11-23 12:43 ` Mark Kettenis
2012-11-23 16:30 ` H.J. Lu
2012-11-23 18:19 ` Pedro Alves [this message]
2012-11-23 18:43 ` Jan Kratochvil
2012-11-25 18:15 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50AFBE11.2050908@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox