From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86973 invoked by alias); 1 Apr 2018 04:32:38 -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 86934 invoked by uid 89); 1 Apr 2018 04:32:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD,UNSUBSCRIBE_BODY autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 01 Apr 2018 04:32:35 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6A0F01E030; Sun, 1 Apr 2018 00:32:33 -0400 (EDT) Subject: Re: [PATCH v2 05/15] Fix elf_gnu_ifunc_resolve_by_got buglet To: Pedro Alves , gdb-patches@sourceware.org References: <20180325191943.8246-1-palves@redhat.com> <20180325191943.8246-6-palves@redhat.com> From: Simon Marchi Message-ID: <65e568e8-ef50-0119-27ec-053849592706@simark.ca> Date: Sun, 01 Apr 2018 04:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180325191943.8246-6-palves@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-04/txt/msg00010.txt.bz2 On 2018-03-25 03:19 PM, Pedro Alves wrote: > The next patch will add a call to elf_gnu_ifunc_resolve_by_got that > trips on a latent buglet -- the function is writing to its output > parameter even if the address wasn't found, confusing the caller. The > function's intro comment says: > > /* Try to find the target resolved function entry address of a STT_GNU_IFUNC > function NAME. If the address is found it is stored to *ADDR_P (if ADDR_P > is not NULL) and the function returns 1. It returns 0 otherwise. > > So fix the function accordingly. > > gdb/ChangeLog: > yyyy-mm-dd Pedro Alves > > * elfread.c (elf_gnu_ifunc_resolve_by_got): Don't write to *ADDR_P > unless we actually resolved the ifunc. > --- > gdb/elfread.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/gdb/elfread.c b/gdb/elfread.c > index 9ffbf99db6e..82ab3d891ce 100644 > --- a/gdb/elfread.c > +++ b/gdb/elfread.c > @@ -840,10 +840,12 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) > ¤t_target); > addr = gdbarch_addr_bits_remove (gdbarch, addr); > > - if (addr_p) > - *addr_p = addr; > if (elf_gnu_ifunc_record_cache (name, addr)) > - return 1; > + { > + if (addr_p) addr_p != NULL ? Simon