Bug 17407 - Regression for Linux vDSO reading
Summary: Regression for Linux vDSO reading
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.8
: P2 normal
Target Milestone: 7.8
Assignee: Jan Kratochvil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-17 18:59 UTC by Jan Kratochvil
Modified: 2021-11-09 08:32 UTC (History)
2 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2014-09-17 18:59:42 UTC
since
	5979d6b69b20a8355ea94b75fad97415fce4788c
	https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=5979d6b69b20a8355ea94b75fad97415fce4788c
	vdso handling
	https://sourceware.org/ml/binutils/2014-03/msg00082.html
	https://sourceware.org/ml/binutils/2014-04/msg00003.html
	Message-ID: <A78C989F6D9628469189715575E55B230AA884EB@IRSMSX104.ger.corp.intel.com>
I get on
	kernel-3.16.2-200.fc20.x86_64
	https://koji.fedoraproject.org/koji/buildinfo?buildID=575860
	attaching its vdso.bin.gz
GDB (FSF HEAD 5e43d46791c4c66fd83947a12d4f716b561a9103) regression:
reproducer for Fedora systems (as Fedora glibc is patched):
	./gdb -ex r --args $PWD/../../glibc-root/lib/ld-linux-x86-64.so.2 --library-path $PWD/../../glibc-root/lib:/lib64 ./gdb
assuming an untested reproducer for more upstream glibc (Debian?); not tested:
	./gdb -ex start ./gdb
actual result / FAIL:
	Got object file from memory but can't read symbols: File truncated.
expected result / PASS:
	warning: Could not load shared library symbols for linux-vdso.so.1.
	Do you need "set solib-search-path" or "set sysroot"?


[bfd patch] Regression for Linux vDSO in GDB
https://sourceware.org/ml/binutils/2014-09/msg00140.html
Comment 1 Sourceware Commits 2014-09-18 06:26:28 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  92c9bcd479e4cb388a7f286fc42414b115cfc656 (commit)
      from  039b3b7b034f4c9ac9e38f8b3e7367e108f89f8a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=92c9bcd479e4cb388a7f286fc42414b115cfc656

commit 92c9bcd479e4cb388a7f286fc42414b115cfc656
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Sep 18 08:21:40 2014 +0200

    Fix regression for Linux vDSO in GDB (PR gdb/17407).
    
    since
    	5979d6b69b20a8355ea94b75fad97415fce4788c
    	https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=5979d6b69b20a8355ea94b75fad97415fce4788c
    	vdso handling
    	https://sourceware.org/ml/binutils/2014-03/msg00082.html
    	https://sourceware.org/ml/binutils/2014-04/msg00003.html
    	Message-ID: <A78C989F6D9628469189715575E55B230AA884EB@IRSMSX104.ger.corp.intel.com>
    I get on
    	kernel-3.16.2-200.fc20.x86_64
    	https://koji.fedoraproject.org/koji/buildinfo?buildID=575860
    	attaching its vdso.bin.gz
    GDB (FSF HEAD 5e43d46791c4c66fd83947a12d4f716b561a9103) regression:
    reproducer:
    	./gdb -ex start ./gdb
    actual result / FAIL:
    	Got object file from memory but can't read symbols: File truncated.
    expected result / PASS:
    	<nothing>
    or / PASS:
    	warning: Could not load shared library symbols for linux-vdso.so.1.
    	Do you need "set solib-search-path" or "set sysroot"?
    
    That "warning: Could not load shared library..." is mostly harmless (it is
    a bug in GDB), in the FAIL case it is not printed just because
    bfd_check_format() fails there.
    
    It seems logical to me this way when the 'size' parameter has been already
    added.
    Alan Modra:
    I was wrongly thinking that the section headers were
    always last when I wrote that code.  (They are now!  If you relink
    that vdso with current binutils master you won't hit this problem, but
    that of course doesn't help existing kernels.)
    
    I do not see a regression for add-symbol-file-from-memory for libncurses.so.5
    from the original thread above.
    
      Start of section headers:          1080 (bytes into file)
      Size of section headers:           64 (bytes)
      Number of section headers:         13
      Section header string table index: 8
    Section Headers:
      [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
      [ 8] .fake_shstrtab    STRTAB          0000000000000780 000780 000076 00   A  0   0 32
    Program Headers:
      Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
      LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0012fe 0x0012fe R E 0x1000
    
    size == 0x2000
    shdr_end == 0x778 == 1080 + 13 * 64
    high_offset == 0x12fe
    
           else if (size >= shdr_end)
    -	high_offset = shdr_end;
    +	high_offset = size;
    
    But then 0x778 < 0x780 for "Section header string table index" so whole
    bfd_check_format() fails because section headers were not cleared here:
      /* If the segments visible in memory didn't include the section headers,
         then clear them from the file header.  */
      if (high_offset < shdr_end)
    
    bfd/ChangeLog
    2014-09-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	PR gdb/17407
    	* elfcode.h (bfd_from_remote_memory): Use SIZE for HIGH_OFFSET.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog |    5 +++++
 bfd/elfcode.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
Comment 2 Sourceware Commits 2014-09-18 06:29:15 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, gdb-7.8-branch has been updated
       via  54fbc750b54271efb75ae11ce49f14c4234a9476 (commit)
      from  6e4257b081621e64f4974d0c2cc12cbc5e542307 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54fbc750b54271efb75ae11ce49f14c4234a9476

commit 54fbc750b54271efb75ae11ce49f14c4234a9476
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Sep 18 08:21:40 2014 +0200

    Fix regression for Linux vDSO in GDB (PR gdb/17407).
    
    since
    	5979d6b69b20a8355ea94b75fad97415fce4788c
    	https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=5979d6b69b20a8355ea94b75fad97415fce4788c
    	vdso handling
    	https://sourceware.org/ml/binutils/2014-03/msg00082.html
    	https://sourceware.org/ml/binutils/2014-04/msg00003.html
    	Message-ID: <A78C989F6D9628469189715575E55B230AA884EB@IRSMSX104.ger.corp.intel.com>
    I get on
    	kernel-3.16.2-200.fc20.x86_64
    	https://koji.fedoraproject.org/koji/buildinfo?buildID=575860
    	attaching its vdso.bin.gz
    GDB (FSF HEAD 5e43d46791c4c66fd83947a12d4f716b561a9103) regression:
    reproducer:
    	./gdb -ex start ./gdb
    actual result / FAIL:
    	Got object file from memory but can't read symbols: File truncated.
    expected result / PASS:
    	<nothing>
    or / PASS:
    	warning: Could not load shared library symbols for linux-vdso.so.1.
    	Do you need "set solib-search-path" or "set sysroot"?
    
    That "warning: Could not load shared library..." is mostly harmless (it is
    a bug in GDB), in the FAIL case it is not printed just because
    bfd_check_format() fails there.
    
    It seems logical to me this way when the 'size' parameter has been already
    added.
    Alan Modra:
    I was wrongly thinking that the section headers were
    always last when I wrote that code.  (They are now!  If you relink
    that vdso with current binutils master you won't hit this problem, but
    that of course doesn't help existing kernels.)
    
    I do not see a regression for add-symbol-file-from-memory for libncurses.so.5
    from the original thread above.
    
      Start of section headers:          1080 (bytes into file)
      Size of section headers:           64 (bytes)
      Number of section headers:         13
      Section header string table index: 8
    Section Headers:
      [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
      [ 8] .fake_shstrtab    STRTAB          0000000000000780 000780 000076 00   A  0   0 32
    Program Headers:
      Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
      LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0012fe 0x0012fe R E 0x1000
    
    size == 0x2000
    shdr_end == 0x778 == 1080 + 13 * 64
    high_offset == 0x12fe
    
           else if (size >= shdr_end)
    -	high_offset = shdr_end;
    +	high_offset = size;
    
    But then 0x778 < 0x780 for "Section header string table index" so whole
    bfd_check_format() fails because section headers were not cleared here:
      /* If the segments visible in memory didn't include the section headers,
         then clear them from the file header.  */
      if (high_offset < shdr_end)
    
    bfd/ChangeLog
    2014-09-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	PR gdb/17407
    	* elfcode.h (bfd_from_remote_memory): Use SIZE for HIGH_OFFSET.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog |    5 +++++
 bfd/elfcode.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
Comment 3 Jan Kratochvil 2014-09-18 06:31:10 UTC
Checked in and for 7.8.
Comment 4 Sourceware Commits 2014-10-29 19:48:16 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The annotated tag, gdb-7.8.1-release has been created
        at  60cd8f8e7f38daf7d59e82b9fb3b8840a3a714c9 (tag)
   tagging  21de41c04a26bb04f2e827d35fd48c991fa991b1 (commit)
  replaces  gdb-7.8-release
 tagged by  Joel Brobecker
        on  Wed Oct 29 12:47:08 2014 -0700

- Log -----------------------------------------------------------------
GDB 7.8.1 Release.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlRRRDwACgkQku2wS/8yXPNA3gCgmaBkksiuRbHoYAudWcZYwiJ4
upIAoI2vGr/6e6CNHxIinVYQ2IJCY/4V
=wgXR
-----END PGP SIGNATURE-----

Doug Evans (3):
      Fix for PR 17247: Block SIGCHLD while initializing Guile.
      PR guile/17367
      PR python/17364

Eli Zaretskii (1):
      Avoid compiler warnings about incomplete parameter types.

GDB Administrator (92):
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in
      Automatic date update in version.in

Jan Kratochvil (4):
      Fix incorrect placement of two Intel gdb/NEWS items
      Fix 'gcore' with exited threads
      Fix crash on Python frame filters with unreadable arg
      Fix regression for Linux vDSO in GDB (PR gdb/17407).

Joel Brobecker (5):
      Document the GDB 7.8 release in gdb/ChangeLog
      Bump GDB version number to 7.8.0.DATE-cvs.
      Add "frame.h" #include in gdbarch.h.
      state->dr_control_mirror == 0 failed assertion in gdbserver on Windows XP
      Set GDB version number to 7.8.1.

Pedro Alves (9):
      testsuite: refactor spawn and wait for attach
      gdb/17347 - Regression: GDB stopped on run with attached process
      Aarch64: Make CPSR a 32-bit register again in the target description
      Make common code handle target_terminal_* idempotency
      PR gdb/17472: With annotations, input while executing in the foreground crashes readline/GDB
      PR gdb/17300: Input after "c -a" crashes readline/GDB
      PR gdb/17471: Repeating a background command makes it foreground
      PR python/17372 - Python hangs when displaying help()
      PR 17408 - assertion failure in switch_back_to_stepped_thread

Siva Chandra (1):
      Fix xmethod Python so that it works with Python3.

Yao Qi (2):
      Fix build/17104
      Remove workaround to libbabeltrace 1.1.0 issue

-----------------------------------------------------------------------
Comment 5 Stewart 2021-11-09 08:32:14 UTC Comment hidden (spam)