From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46691 invoked by alias); 1 Nov 2019 09:00:28 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 46678 invoked by uid 89); 1 Nov 2019 09:00:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-11.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Nov 2019 09:00:26 +0000 Received: from librem (unknown [145.15.244.14]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 48DF5302BB35; Fri, 1 Nov 2019 10:00:23 +0100 (CET) Received: by librem (Postfix, from userid 1000) id DACCCC02C4; Fri, 1 Nov 2019 10:00:15 +0100 (CET) Date: Fri, 01 Nov 2019 09:00:00 -0000 From: Mark Wielaard To: Jonathon Anderson Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] libdw: Don't free uninitialized Dwarf_Abbrev_Hash's of "fake" CUs. Message-ID: <20191101090015.GF2805@wildebeest.org> References: <20191031225954.GD2805@wildebeest.org> <20191031234217.19562-1-jma14@rice.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191031234217.19562-1-jma14@rice.edu> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00098.txt.bz2 On Thu, Oct 31, 2019 at 06:42:18PM -0500, Jonathon Anderson wrote: > fake_{loc,loclists,addr}_cu are Dwarf_CUs that are created separate from > all the others, so their contents are minimal and mostly initialized by > a calloc. On dwarf_end however, they are freed through the same code path > as all the others, so they call DAH_free like all the others. This changes > that so that these three are exempt from DAH and split-DWARF matters, and > swaps the calloc for a malloc so Memcheck will catch any others. > --- > > The Dwarf_Abbrev_Hash_free looks in the correct place. But I don't > > believe the Free split dwarf hunk should not be under the same if > > not-fake block. > > That can be fixed. > > I don't really like `unit_type = 0`, but its the only value that isn't one > of the DW_UT values. And its what the calloc would've done. O! Sorry. I now see your original approach was actually correct. For some reason I believed the fake cus could have a split DWARF. But of course they never have. The reason I gave was wrong, but I still like this patch a little better because it more explicitly sets the needed values. Your original approach however makes more sense if you like valgrind memcheck to catch more issues. Could you add a Signed-off-by and ChangeLog entry? Either for your original patch or this one. Whichever you like best.. Thanks, Mark