From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3237 invoked by alias); 12 Oct 2011 18:50:33 -0000 Received: (qmail 3224 invoked by uid 22791); 12 Oct 2011 18:50:31 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 18:50:17 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RE3sd-0006fC-4S for gdb-patches@sources.redhat.com; Wed, 12 Oct 2011 20:50:15 +0200 Received: from 209.226.137.108 ([209.226.137.108]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Oct 2011 20:50:15 +0200 Received: from aristovski by 209.226.137.108 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Oct 2011 20:50:15 +0200 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: Re: [patch] Relocate phdr in read_program_header Date: Wed, 12 Oct 2011 18:50:00 -0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110923 Thunderbird/7.0 In-Reply-To: X-IsSubscribed: yes 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: 2011-10/txt/msg00369.txt.bz2 ping? On 11-09-30 03:31 PM, Aleksandar Ristovski wrote: > Hello, > > When attaching to a process without the executable file, gdb reads > pheaders from the target (solib-svr4.c: read_program_header). > > However, it does not take into account possibility of having PIE > executable on the other end, resulting in trying to read from > unrelocated phdr address. > > This patch addresses the issue by looking for PT_PHDR; if found, uses it > to determine relocation and adjusts address before reading it from > target memory. > > Testsuite on x86_64-unknown-linux-gnu did not show any regressions. > > > Thanks, > > > Aleksandar Ristovski > QNX Software Systems > > > > ... Aleksandar Ristovski > > * solib-svr4.c (read_program_header): If PT_PHDR is present, use it > to calculate correct address in case of PIE. >