public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id
@ 2014-06-17 22:53 luto at mit dot edu
  2014-06-18  3:42 ` [Bug symtab/17064] " luto at mit dot edu
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-17 22:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

            Bug ID: 17064
           Summary: gdb's can't find Linux 3.16-rc1's vdso build-id
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: luto at mit dot edu

In Linux 3.16-rc1, the vdso is more heavily stripped than it is in prior
versions.  It has no section table*.  Nonetheless, gdb should still be able to
find its build-id, because its PT_NOTE phdr is in perfect order.  eu-readelf -n
works, but readelf -n does not.

(Actually, there's a complication: due to a workaround for a bug in Go, the
64-bit vdso currently has a fake section header that does not contain a note
section.  This causes even elfutils to be unable to find the ELF notes.  If
necessary, I can change that.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
@ 2014-06-18  3:42 ` luto at mit dot edu
  2014-06-18  7:22 ` nickc at redhat dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18  3:42 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #1 from Andy Lutomirski <luto at mit dot edu> ---
I think the bug is in bfd_elf_bfd_from_remote_memory, which isn't even trying
to load phdrs when section headers are unavailable.  The binutils phdr parser
knows how to read PT_NOTE.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
  2014-06-18  3:42 ` [Bug symtab/17064] " luto at mit dot edu
@ 2014-06-18  7:22 ` nickc at redhat dot com
  2014-06-18 10:23 ` palves at redhat dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: nickc at redhat dot com @ 2014-06-18  7:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #2 from Nick Clifton <nickc at redhat dot com> ---
Hi Andy,

  Could you upload a copy of the stipped binary for us to play with ?  32-bit
and 64-bit versions if possible.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
  2014-06-18  3:42 ` [Bug symtab/17064] " luto at mit dot edu
  2014-06-18  7:22 ` nickc at redhat dot com
@ 2014-06-18 10:23 ` palves at redhat dot com
  2014-06-18 14:53 ` luto at mit dot edu
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: palves at redhat dot com @ 2014-06-18 10:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #3 from Pedro Alves <palves at redhat dot com> ---
Which GDB version?

Note bfd_elf_bfd_from_remote_memory was changed recently to better handle the
vDSO.  E.g., 5979d6b69b20a8355ea94b75fad97415fce4788c.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (2 preceding siblings ...)
  2014-06-18 10:23 ` palves at redhat dot com
@ 2014-06-18 14:53 ` luto at mit dot edu
  2014-06-18 14:55 ` luto at mit dot edu
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18 14:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #4 from Andy Lutomirski <luto at mit dot edu> ---
Created attachment 7642
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7642&action=edit
Stripped vDSO image

This is the 64-bit image mapped into memory for whatever config I'm running on
revision e0bf7b86dace87eccdabdd66d2769ccad19cb81c of the tip/x86/vdso tree.  It
should be more or less identical to Linus' tree, assuming he's fully caught up.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (3 preceding siblings ...)
  2014-06-18 14:53 ` luto at mit dot edu
@ 2014-06-18 14:55 ` luto at mit dot edu
  2014-06-18 14:58 ` palves at redhat dot com
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18 14:55 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #5 from Andy Lutomirski <luto at mit dot edu> ---
Created attachment 7643
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7643&action=edit
32-bit stripped vDSO image

32-bit variant.  This one has no sections at all, because the Go workaround
isn't needed for 32-bit code (I think).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (4 preceding siblings ...)
  2014-06-18 14:55 ` luto at mit dot edu
@ 2014-06-18 14:58 ` palves at redhat dot com
  2014-06-18 15:01 ` luto at mit dot edu
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: palves at redhat dot com @ 2014-06-18 14:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #6 from Pedro Alves <palves at redhat dot com> ---
GDB version?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (5 preceding siblings ...)
  2014-06-18 14:58 ` palves at redhat dot com
@ 2014-06-18 15:01 ` luto at mit dot edu
  2014-06-18 15:19 ` palves at redhat dot com
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18 15:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #7 from Andy Lutomirski <luto at mit dot edu> ---
I tested GDB version 7.7.1-13.fc20.

GDB/binutils revision 5979d6b69b20a8355ea94b75fad97415fce4788c is unlikely to
help.  It's actually related to why I changed the vdso in the first place.

The issue is that there's now user/kernel shared data right after the vdso
PT_LOAD segment.  That breaks if the section headers spill past the end of the
last page in the vdso PT_LOAD segment.  It's also nice to keep the vdso mapping
as small as possible.  My solution was to just strip off the section headers
entirely.

If necessary, I'm willing to compromise in the kernel (I already had to for
Go), but it looked like this should be easy to fix in binutils.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (6 preceding siblings ...)
  2014-06-18 15:01 ` luto at mit dot edu
@ 2014-06-18 15:19 ` palves at redhat dot com
  2014-06-18 15:29 ` luto at mit dot edu
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: palves at redhat dot com @ 2014-06-18 15:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #8 from Pedro Alves <palves at redhat dot com> ---
"unlikely to help" != "I tested current mainline and it doesn't help". ;-)  

> It's actually related to why I changed the vdso in the first place.

How so?

> My solution was to just strip off the section headers entirely.

This will break btrace disassembly again:

  https://sourceware.org/ml/gdb-patches/2014-04/msg00055.html

GDB could be fixed to not rely on section headers, but, that wouldn't look like
7.8 material, which has just branched...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (7 preceding siblings ...)
  2014-06-18 15:19 ` palves at redhat dot com
@ 2014-06-18 15:29 ` luto at mit dot edu
  2014-06-18 15:37 ` palves at redhat dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18 15:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #9 from Andy Lutomirski <luto at mit dot edu> ---
(In reply to Pedro Alves from comment #8)
> "unlikely to help" != "I tested current mainline and it doesn't help". ;-)  

True.  But I'm on an amazingly slow connection, so I probably won't be able to
build and test gdb today.

> 
> > It's actually related to why I changed the vdso in the first place.
> 
> How so?

The section headers dangling off the last loadable page were a problem for the
vdso implementation as well as for gdb, so I wanted to get rid of them.

> 
> > My solution was to just strip off the section headers entirely.
> 
> This will break btrace disassembly again:
> 
>   https://sourceware.org/ml/gdb-patches/2014-04/msg00055.html
> 
> GDB could be fixed to not rely on section headers, but, that wouldn't look
> like 7.8 material, which has just branched...

Yuck.

How accurate do the section headers need to be?  Will having section headers
that don't match between the in-memory vdso and the symbol file be a problem?

IOW, if I give a section for the entire loadable segment, a dummy shstrndx
section (maybe actually aliased to another section to save space), a note
section, and a SHT_SYNDYM section (for Go), will gdb work?  Will it lose
functionality like CFI data when it loads the symbol file if the in-memory
sections don't match quite right?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (8 preceding siblings ...)
  2014-06-18 15:29 ` luto at mit dot edu
@ 2014-06-18 15:37 ` palves at redhat dot com
  2014-06-18 19:56 ` luto at mit dot edu
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: palves at redhat dot com @ 2014-06-18 15:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus.t.metzger at intel dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (9 preceding siblings ...)
  2014-06-18 15:37 ` palves at redhat dot com
@ 2014-06-18 19:56 ` luto at mit dot edu
  2014-06-19 13:13 ` nickc at redhat dot com
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-18 19:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #10 from Andy Lutomirski <luto at mit dot edu> ---
Apparently even stripping the names off of the sections breaks gdb.  This stuff
seems really fragile.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (10 preceding siblings ...)
  2014-06-18 19:56 ` luto at mit dot edu
@ 2014-06-19 13:13 ` nickc at redhat dot com
  2014-06-19 13:16 ` nickc at redhat dot com
  2014-06-19 14:48 ` luto at mit dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: nickc at redhat dot com @ 2014-06-19 13:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #11 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 7644
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7644&action=edit
process note segments when no note sections are found

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (11 preceding siblings ...)
  2014-06-19 13:13 ` nickc at redhat dot com
@ 2014-06-19 13:16 ` nickc at redhat dot com
  2014-06-19 14:48 ` luto at mit dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: nickc at redhat dot com @ 2014-06-19 13:16 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #12 from Nick Clifton <nickc at redhat dot com> ---
Hi Andy,

  Fixing "readelf -n" is fairly easy - the uploaded patch takes care of this.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug symtab/17064] gdb's can't find Linux 3.16-rc1's vdso build-id
  2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
                   ` (12 preceding siblings ...)
  2014-06-19 13:16 ` nickc at redhat dot com
@ 2014-06-19 14:48 ` luto at mit dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: luto at mit dot edu @ 2014-06-19 14:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17064

--- Comment #13 from Andy Lutomirski <luto at mit dot edu> ---
It looks like gdb has a lot of trouble using debug symbols for DSOs that are
heavily stripped: it tries to line up addresses by section name.  I don't know
whether symbols for section-table-less DSOs are expected to work at all.

I sent these kernel patches:

http://lkml.kernel.org/g/cover.1403129369.git.luto@amacapital.net

The re-add a lot of bloat, making the vdso be two pages again, but they seem to
restore gdb's ability to debug it.

If gdb gains the ability to debug fully-stripped DSOs at some point, then maybe
I can revert those patches.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-06-19 14:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 22:53 [Bug symtab/17064] New: gdb's can't find Linux 3.16-rc1's vdso build-id luto at mit dot edu
2014-06-18  3:42 ` [Bug symtab/17064] " luto at mit dot edu
2014-06-18  7:22 ` nickc at redhat dot com
2014-06-18 10:23 ` palves at redhat dot com
2014-06-18 14:53 ` luto at mit dot edu
2014-06-18 14:55 ` luto at mit dot edu
2014-06-18 14:58 ` palves at redhat dot com
2014-06-18 15:01 ` luto at mit dot edu
2014-06-18 15:19 ` palves at redhat dot com
2014-06-18 15:29 ` luto at mit dot edu
2014-06-18 15:37 ` palves at redhat dot com
2014-06-18 19:56 ` luto at mit dot edu
2014-06-19 13:13 ` nickc at redhat dot com
2014-06-19 13:16 ` nickc at redhat dot com
2014-06-19 14:48 ` luto at mit dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).