From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13810 invoked by alias); 13 Nov 2019 18:34:24 -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 13797 invoked by uid 89); 13 Nov 2019 18:34:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-32.2 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=inhouse, in-house, H*c:alternative X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Nov 2019 18:34:23 +0000 Received: by mail-wm1-f68.google.com with SMTP id f3so3149660wmc.5 for ; Wed, 13 Nov 2019 10:34:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O3P1Yd/hl+j/PWPmmyhiFZ3amm46w07B3Eb9zObl+QQ=; b=utPPjd4S/2vUpfdk7NDhkWf/IDDQKTnRqJG6SGq6SZHH+b4ZNTwsf7Y4el1k51AD6I JSgYHyCS2wkiTQbhKXqqM6un7Cg7wNTxkcYEjlya21bZxMHzDIsn14Di/2oGcJ4w1B3g R85GnJQlKuJjIllq81m9emhMl3Fdd5q/cC0h1tRoF1/CLU+zQL3/RwCHJKo+CBsyqkYT dZHQuu0Irh7YWB4ht7fWMX6ctgDBb+mUDag+PkhjhKnfCs5ihwopEqK82o6rpN7I8fcR iKiuI9tU6eRQk3VZHt7nOKNkhpxKTB1aYP9ADFMKBOgK8+7fFpzg4hiCKwzxv/S+4fYv 8wSA== MIME-Version: 1.0 References: <20191107040541.208168-1-tamur@google.com> In-Reply-To: <20191107040541.208168-1-tamur@google.com> From: "Ali Tamur via gdb-patches" Reply-To: Ali Tamur Date: Wed, 13 Nov 2019 18:34:00 -0000 Message-ID: Subject: Re: [PATCH] Fix infinite recursion bug at get_msymbol_address. To: gdb-patches@sourceware.org Cc: Tom Tromey Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg00364.txt.bz2 Friendly ping? On Wed, Nov 6, 2019 at 8:05 PM Ali Tamur wrote: > The patch 4b610737f0 seems to have introduced the possibility of infinite > recursion. I have encountered the problem while debugging a failing > in-house > test. I am sorry, it is fairly difficult to reduce the test case (and I > don't > understand most of what is going on) but the stack trace shows a call to > objfpy_add_separate_debug_file, which eventually causes > lookup_minimal_symbol_by_pc_name to be invoked, which calls > get_msymbol_address. > Somehow lookup_minimal_symbol_linkage finds the same symbol and the > function > calls itself with the same parameters. I don't know whether this should be > classified as 'it should never happen', but this simple patch makes the > test > pass and should be harmless, I think. > > gdb/ChangeLog > > * symtab.c (get_msymbol_address): Guard against infinite recursion. > --- > gdb/symtab.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/symtab.c b/gdb/symtab.c > index 2c934b9c22..b231cc6e84 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -6328,7 +6328,7 @@ get_msymbol_address (struct objfile *objf, const > struct minimal_symbol *minsym) > { > bound_minimal_symbol found > = lookup_minimal_symbol_linkage (linkage_name, objfile); > - if (found.minsym != nullptr) > + if (found.minsym != nullptr && found.minsym != minsym) > return BMSYMBOL_VALUE_ADDRESS (found); > } > } > -- > 2.24.0.rc1.363.gb1bccd3e3d-goog > >