From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30370 invoked by alias); 19 Nov 2019 03:47:12 -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 30356 invoked by uid 89); 19 Nov 2019 03:47:12 -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=Friendly, H*c:alternative X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 03:47:10 +0000 Received: by mail-wm1-f66.google.com with SMTP id z19so1757985wmk.3 for ; Mon, 18 Nov 2019 19:47:10 -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=4qqCMUXZLbXTHO3m9j4K2fTguaKewnXtXUUieVwbz6w=; b=H09VKXLEOK/7ALe9aejAG1SCgO/tICiWjNfzBupO6mtyQV5B/OhN7wotle8KWGvt53 adLN4UI07iqbxsSX2pd3UQV0ogemwpveMnnQ2bYQ9D5XKNaqqzUCzQMY81bwIk955jZQ xPNEF+x2Bk9IKO/Mm+GwmI5GAUeakNrXaeeYqOmparN+D1UdjneCdB503OzlSeWCsFkD UmwaCHOYKG7vsTtqQRmoL4tizaTJ5G5JjVIvk3InUXxQh+pcZUI79JOmJpkNGZ/1JPM4 Y/LhZzVZjNLJEht3YoCqHqnxk0naOFurs08UF4/BTwimeaASnXCOCByDzCIlTBDQRr6K Y12Q== MIME-Version: 1.0 References: <20191107040541.208168-1-tamur@google.com> In-Reply-To: From: "Ali Tamur via gdb-patches" Reply-To: Ali Tamur Date: Tue, 19 Nov 2019 03:47: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/msg00577.txt.bz2 If there are no objections, I am planning to check this in a couple days. Thank you. Ali On Wed, Nov 13, 2019 at 10:34 AM Ali Tamur wrote: > 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 >> >>