From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8995 invoked by alias); 27 Dec 2012 20:07:11 -0000 Received: (qmail 8986 invoked by uid 22791); 27 Dec 2012 20:07:10 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from na3sys009aog122.obsmtp.com (HELO na3sys009aog122.obsmtp.com) (74.125.149.147) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Dec 2012 20:06:55 +0000 Received: from mx10.qnx.com ([209.226.137.110]) (using TLSv1) by na3sys009aob122.postini.com ([74.125.148.12]) with SMTP ID DSNKUNyqXuDktgA3n7WGczy4TTdwH1bNwHob@postini.com; Thu, 27 Dec 2012 12:06:55 PST Received: by mx10.qnx.com (Postfix, from userid 500) id 6113921172; Thu, 27 Dec 2012 15:06:53 -0500 (EST) Received: from exhts.ott.qnx.com (exhts2 [10.222.2.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx10.qnx.com (Postfix) with ESMTPS id 0CB202116F; Thu, 27 Dec 2012 15:06:53 -0500 (EST) Received: from [10.222.96.215] (10.222.96.215) by exhts2.ott.qnx.com (10.222.2.25) with Microsoft SMTP Server id 14.2.318.1; Thu, 27 Dec 2012 15:06:53 -0500 Message-ID: <50DCAA5C.3000301@qnx.com> Date: Thu, 27 Dec 2012 20:07:00 -0000 From: Aleksandar Ristovski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jan Kratochvil CC: "gdb-patches@sourceware.org" Subject: Re: [patch] validate binary before use References: <50D4C49A.6040502@qnx.com> <50D8B37A.20001@qnx.com> <20121225073709.GA11349@host2.jankratochvil.net> In-Reply-To: <20121225073709.GA11349@host2.jankratochvil.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2012-12/txt/msg00821.txt.bz2 On 12-12-25 02:37 AM, Jan Kratochvil wrote: > On Mon, 24 Dec 2012 20:56:42 +0100, Aleksandar Ristovski wrote: >> While writing a testcase I realized the patch as posted did not work >> in general cases. Comparing whole elf header and whole pheader is >> not an option as they change depending on whether the binary is >> stripped and such. > > The checked fields like vaddr also do not match as the local file is commonly > nightly prelinked, unprelinked (after nightly update before prelink has run) > or nightly re-prelinked (see prelink(8)). > > Such prelink-aware verification is already implemented in solib-svr4.c in > svr4_exec_displacement. GDB also handles correctly local symbol file in > a different prelink state than the debugged target. Ok, I will fix that. > > But still I find this verification less reliable and more complicated than the > build-id verification I suggested. > build-id would be great if it was required by the standard and mapped into loadable segments. AFAIK neither is true. I am after a generic solution that will rely only on what's in the memory. I will propose new patch addressing this and John Gilmore's comments (he made them here: http://sourceware.org/ml/gdb/2012-12/msg00080.html) but probably no sooner than mid-January. --- Aleksandar