From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99137 invoked by alias); 21 Aug 2015 21:20:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 99125 invoked by uid 89); 21 Aug 2015 21:20:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 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; Fri, 21 Aug 2015 21:20:11 +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 (Postfix) with ESMTPS id 27B5D19F20F for ; Fri, 21 Aug 2015 21:20:10 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7LLK8Qa018814 for ; Fri, 21 Aug 2015 17:20:09 -0400 Subject: [PATCH v12 00/32] Validate binary before use From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Fri, 21 Aug 2015 21:20:00 -0000 Message-ID: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00590.txt.bz2 Hi, git://sourceware.org/git/archer.git jankratochvil/gdbserverbuildid The new file-locating parts are freshly coded, there are many possible future improvements but I find the patchset as a minimal functional upstreamable support for locating files from gdbserver build-ids. It does not support build-ids from linux-nat and core files (as Fedora GDB supports). It also does not ask librpm for debuginfo-install suggestions. There remain callers (like exec_file_and_symbols_resync) using various old functions returning only 'char *filename;'. This means if target binary has build-id GDB will open the file twice - first to verify the build-id and second to really start using that file. The new functions returning 'struct file_location file;' open such file as BFD only once. It could cache already unsuccessfully searched paths. With current sysroot ":target:" (that is ""+"target:") if target_filesystem_is_local() then all the directories including debug-file-directory etc. will be searched twice (if no matching file is found). A quick but incomplete fix would be to only suppress the second "target:" default sysroot part if target_filesystem_is_local(). This means that this patchset as is may be a performance regression. But main executable is only one and shared libraries should use the "fast" 'struct file_location file;' code path. But I haven't really traced/benchmarked it. It could suppress repeated warning messages about non-matching build-ids. It may be related to the previous paragraph. GDB could offload the build-id search in target: directories to gdbserver. Currently if sysroot and/or debug-file-directory and other directory lists contain multiple target:-starting paths GDB will ask gdbserver for each one separately, each time sending vFile:open:..., multiple vFile:pread: etc. (guessing), with each call costing one RTT. Thanks, Jan v12 * Add COREFILTER_ANON_PRIVATE and COREFILTER_ANON_SHARED to filterflags. * Free build_id in free_so(), not clear_so(). * Add all the parts for locating (not just verifying) files by build-id. v11 * Use configure.tgt+ALL_TARGET_OBS instead of config/**.mh . * Move linux-maps.[ch] nat/ -> common/ . * Rename set solib-build-id-force -> set validate-build-id . * Rebase: Remove bfd_target_elf_flavour and elf_tdata->build_id requirement. * More descriptive warning messages. v7 * move linux-maps.[ch] common/->nat/ and target-utils.[ch] common/->target/ * remove GDBSERVER #ifdefs * rebase on top of the new 'struct inferior *inf' parameter v6 * move also gdb_regex* to common/ as discussed above, also in config*.ac * skip_to_space{,_const}() were moved to common/ * common/common-defs.h #include reordering * new passing of enum filterflags from linux_qxfer_libraries_svr4() * dropped refactoring of code moved to common/ that avoided GDB exceptions * new svr4_copy_library_list() needs to handle new so_list->build_id v5 * svr4_validate() considers missing local build-id as not-a-match * target_so_ops->validate() now returns not-a-match reason as a string * rename common/common-target.[ch] -> common/target-utils.[ch] * testcase runs (but broken) even on different-filesystem remote target * testcase simplified by using with_test_prefix() v4 * NEWS, doc/gdb.texinfo additions. * Used host-defs.h. * New set/show solib-build-id-force. * testsuite: Do not run on non-localhost remote targets. v3 [patchv3 0/8] Validate binary before use https://sourceware.org/ml/gdb-patches/2014-02/msg00842.html Message-ID: <20140227213229.GA21121@host2.jankratochvil.net> * Implemented the review comments I made. * Removed fetching build-id in solib-svr4.c for NAT run. v2 [PATCH 0/8] v2 - validate binary before use https://sourceware.org/ml/gdb-patches/2013-04/msg00472.html Message-ID: <1366127096-5744-1-git-send-email-ARistovski@qnx.com> --- gdb/testsuite/gdb.base/attach.exp | 7 + gdb/testsuite/gdb.base/break-probes.exp | 7 + gdb/testsuite/gdb.base/main-mismatch-mod.c | 39 +++++ gdb/testsuite/gdb.base/main-mismatch.c | 39 +++++ gdb/testsuite/gdb.base/main-mismatch.exp | 158 +++++++++++++++++++ gdb/testsuite/gdb.base/solib-mismatch-lib.c | 30 ++++ gdb/testsuite/gdb.base/solib-mismatch-libmod.c | 30 ++++ gdb/testsuite/gdb.base/solib-mismatch.c | 56 +++++++ gdb/testsuite/gdb.base/solib-mismatch.exp | 198 ++++++++++++++++++++++++ 9 files changed, 560 insertions(+), 4 deletions(-) create mode 100644 gdb/testsuite/gdb.base/main-mismatch-mod.c create mode 100644 gdb/testsuite/gdb.base/main-mismatch.c create mode 100644 gdb/testsuite/gdb.base/main-mismatch.exp create mode 100644 gdb/testsuite/gdb.base/solib-mismatch-lib.c create mode 100644 gdb/testsuite/gdb.base/solib-mismatch-libmod.c create mode 100644 gdb/testsuite/gdb.base/solib-mismatch.c create mode 100644 gdb/testsuite/gdb.base/solib-mismatch.exp