From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#9273: 23.3; malloc initialization should (sometimes) happen at runtime Date: Fri, 12 Aug 2011 08:18:39 -0400 Message-ID: <4E451A1F.4060409@cornell.edu> References: <4E41940C.2010605@cornell.edu> <83zkjhxnty.fsf@gnu.org> <4E444D85.4090907@cornell.edu> <838vqzxgq1.fsf@gnu.org> <4E44FC1B.9010207@cornell.edu> <831uwqyidi.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1313151589 21120 80.91.229.12 (12 Aug 2011 12:19:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 12 Aug 2011 12:19:49 +0000 (UTC) Cc: "9273@debbugs.gnu.org" <9273@debbugs.gnu.org> To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 12 14:19:45 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QrqiG-0000cd-Vy for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Aug 2011 14:19:45 +0200 Original-Received: from localhost ([::1]:59739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrqiE-0003yT-4F for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Aug 2011 08:19:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrqiB-0003yD-39 for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2011 08:19:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrqiA-00028h-1Z for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2011 08:19:39 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrqi9-00028d-Si for bug-gnu-emacs@gnu.org; Fri, 12 Aug 2011 08:19:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QrqjW-0005gY-88; Fri, 12 Aug 2011 08:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Aug 2011 12:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9273-submit@debbugs.gnu.org id=B9273.131315162521797 (code B ref 9273); Fri, 12 Aug 2011 12:21:02 +0000 Original-Received: (at 9273) by debbugs.gnu.org; 12 Aug 2011 12:20:25 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qrqiu-0005fU-4S for submit@debbugs.gnu.org; Fri, 12 Aug 2011 08:20:25 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141] helo=authusersmtp.mail.cornell.edu) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qrqir-0005fM-2o for 9273@debbugs.gnu.org; Fri, 12 Aug 2011 08:20:22 -0400 Original-Received: from [192.168.1.4] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id p7CCIsqD009313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 12 Aug 2011 08:18:55 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <831uwqyidi.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 12 Aug 2011 08:21:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50025 Archived-At: On 8/12/2011 7:33 AM, Eli Zaretskii wrote: >> Date: Fri, 12 Aug 2011 06:10:35 -0400 >> From: Ken Brown >> CC: "9273@debbugs.gnu.org"<9273@debbugs.gnu.org> >> >> On 8/12/2011 2:54 AM, Eli Zaretskii wrote: >>>> Date: Thu, 11 Aug 2011 17:45:41 -0400 >>>> From: Ken Brown >>>> CC: "9273@debbugs.gnu.org"<9273@debbugs.gnu.org> >>>> >>>> The problem was that realloc got called on memory that had been >>>> allocated prior to dumping, and the malloc information that was used >>>> then had disappeared. >>> >>> Can you show the code which called realloc on that memory? I'm >>> surprised that Emacs does that, but perhaps I'm missing something. >> >> Here's the code that I stumbled across (as a result of a SEGV). I >> haven't checked to see if there are other examples. From terminal.c: >> >> /* Deletes the bootstrap terminal device. >> Called through delete_terminal_hook. */ >> >> static void >> delete_initial_terminal (struct terminal *terminal) >> { >> if (terminal != initial_terminal) >> abort (); >> >> delete_terminal (terminal); >> initial_terminal = NULL; >> } > > delete_terminal doesn't call realloc, it just calls xfree. Maybe I mis-remembered where the call to realloc is. I'll reproduce it later and let you know. (I don't have time at the moment.) But I assure you that I did a backtrace showing that realloc was called on something related to terminals. > Do the problems with the Cygwin build go away if the call to > delete_terminal is commented out? No. At the very least, I have to force reinitialization of malloc. Otherwise the BLOCK macro yields wrong results that lead to infinite looping or crashing. After reinitialization, I have to be able to handle calls to free() on memory allocated prior to dumping. Probably it's OK to just ignore such calls. If I can also take care of calls to realloc too, everything will be OK. Ken