From patchwork Wed Sep 17 18:55:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2891 Received: (qmail 8730 invoked by alias); 17 Sep 2014 18:56:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 8712 invoked by uid 89); 17 Sep 2014 18:56:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, ZIP_ATTACHED autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 17 Sep 2014 18:56:04 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8HIu0hb027231 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Sep 2014 14:56:01 -0400 Received: from host2.jankratochvil.net (ovpn-116-67.ams2.redhat.com [10.36.116.67]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8HItuvW017560 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 17 Sep 2014 14:55:58 -0400 Date: Wed, 17 Sep 2014 20:55:55 +0200 From: Jan Kratochvil To: binutils@sourceware.org Cc: Pedro Alves , Mark Wielaard , Cary Coutant , Doug Evans , gdb-patches@sourceware.org Subject: [bfd patch] Regression for Linux vDSO in GDB Message-ID: <20140917185555.GA19106@host2.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, 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: 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"? 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. I do not fully understand the original intention for the line I changed there but it seems logical to me this way when the 'size' parameter has been already added. 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) Thanks, Jan bfd/ 2014-09-17 Jan Kratochvil * elfcode.h (bfd_from_remote_memory): Use SIZE for HIGH_OFFSET. diff --git a/bfd/elfcode.h b/bfd/elfcode.h index a49a708..ec53c3b 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1749,7 +1749,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) headers. */ } else if (size >= shdr_end) - high_offset = shdr_end; + high_offset = size; else { bfd_vma page_size = get_elf_backend_data (templ)->minpagesize;