From owner-cvs-all@FreeBSD.ORG Thu Feb 1 16:21:19 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 47DAB16A526; Thu, 1 Feb 2007 16:21:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id C57DF13C512; Thu, 1 Feb 2007 16:21:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l11GL73D091825; Thu, 1 Feb 2007 11:21:13 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Jason Evans Date: Thu, 1 Feb 2007 11:21:09 -0500 User-Agent: KMail/1.9.1 References: <200701312254.l0VMsKZ6050188@repoman.freebsd.org> <346a80220701311514j6aa9e3eavc5a4de2bffc039d7@mail.gmail.com> <45C1316C.8010500@FreeBSD.org> In-Reply-To: <45C1316C.8010500@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702011121.10651.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 01 Feb 2007 11:21:13 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2511/Thu Feb 1 09:55:18 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, cokane@cokane.org Subject: Re: cvs commit: src/lib/libc/stdlib malloc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 16:21:19 -0000 On Wednesday 31 January 2007 19:16, Jason Evans wrote: > Coleman Kane wrote: > > Modified files: > > lib/libc/stdlib malloc.c > > Log: > > Fix a utrace(2)-related bug in calloc(3). > > > > Integrate various pedantic cleanups. > > > > Submitted by: Andrew Doran > > > > > Revision Changes Path > > 1.139 +56 -44 src/lib/libc/stdlib/malloc.c > > _______________________________________________ > > > > Does this fix the following error I get in GDB alot: > > Assertion failed: (mapelm.free == false), function arena_salloc, file > > /usr/src/lib/libc/stdlib/malloc.c, line 2355. > > That assertion failure is likely due to an application bug, specifically > a double free. Yes. I fixed at least one double free in gdb a while back and sent the patch to obrien@ and marcel@ but never heard back. Here's the original message I sent: Tracked down and fixed a bug in ports/gdb6 at work that we've been running into. It appears to apply to src/contrib/gdb as well. I assume you all are more familiar with gdb internals than I am, but there appears to be this target stack of "driver backends" (more or less). And at the top there is a dummy ¤t_target which is _not_ included in the global target_structs list (presumably on purpose). There is this function that realloc()'s a target's to_sections pointer and then goes through and updates all the other targets that are using the same pointer. The problem is that since current_target isn't in the global list, ¤t_target won't get updated if it's using the same value that is being realloc'd (the test case at work involved debugging apache, which makes heavy use of dlopen() and dlclose()). The patch below fixes the problem, and I thought I'd let you 2 see it to see if you wanted to do anything with it: --- gdb/target.c.orig Mon Aug 2 17:57:26 2004 +++ gdb/target.c Mon Oct 30 15:07:51 2006 @@ -1415,6 +1415,13 @@ (*t)->to_sections_end = target->to_sections_end; } } + + /* JHB: Need to update current_target too. */ + if (current_target.to_sections == old_value) + { + current_target.to_sections = target->to_sections; + current_target.to_sections_end = target->to_sections_end; + } } -- John Baldwin