From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24046 invoked by alias); 29 Jul 2008 02:27:47 -0000 Received: (qmail 24038 invoked by uid 22791); 29 Jul 2008 02:27:47 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jul 2008 02:27:26 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 2A2BF98215; Tue, 29 Jul 2008 02:27:24 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id F27F498100; Tue, 29 Jul 2008 02:27:23 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KNevr-0001dz-1c; Mon, 28 Jul 2008 22:27:23 -0400 Date: Tue, 29 Jul 2008 02:27:00 -0000 From: Daniel Jacobowitz To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Handle absence of DT_DEBUG while debugging ld.so Message-ID: <20080729022723.GA6298@caradoc.them.org> Mail-Followup-To: Luis Machado , gdb-patches@sourceware.org References: <1217289278.16935.23.camel@gargoyle> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1217289278.16935.23.camel@gargoyle> User-Agent: Mutt/1.5.17 (2008-05-11) 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: 2008-07/txt/msg00531.txt.bz2 On Mon, Jul 28, 2008 at 08:54:37PM -0300, Luis Machado wrote: > Hi folks, > > When trying to debug ld.so, we may find that the DT_DEBUG entry in > the .dynamic section is missing, thus GDB tries to look for the _r_debug > minimal symbol, and eventually finds it. This works OK as long as the > _r_debug minimal symbol is correct and initialized. > > In the case where GDB fetches an uninitialized _r_debug minimal symbol > and tries to access its address, we have a memory access error, just > like below: > > (gdb) r > Starting program: /foo/lib/ld.so.1 > Cannot access memory at address 0x2f648 > > Thus, we should guard this piece of code against uninitialized addresses > so that GDB can skip this entry and look for another (hopefully) valid > _r_debug symbol. I think this is a PIE-related problem. It has nothing to do with uninitialized, because we're just taking the symbol's address; but the address you've got there looks wrong. It's as if ld.so was loaded at 0x0. How did that happen? -- Daniel Jacobowitz CodeSourcery