From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: allocate_string_data memory corruption Date: Sun, 22 Jan 2006 19:35:03 -0500 Message-ID: <272681AE-627E-4FDF-BD16-246D423524AC@gnu.org> References: <87vewha2zl.fsf@stupidchicken.com> <87zmlq6w62.fsf-monnier+emacs@gnu.org> <87u0bw6wwz.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1137976845 12627 80.91.229.2 (23 Jan 2006 00:40:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2006 00:40:45 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 23 01:40:44 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F0plA-00076t-LC for ged-emacs-devel@m.gmane.org; Mon, 23 Jan 2006 01:40:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F0pnl-0007oP-Va for ged-emacs-devel@m.gmane.org; Sun, 22 Jan 2006 19:43:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F0pmQ-0007eh-LX for emacs-devel@gnu.org; Sun, 22 Jan 2006 19:41:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F0pmO-0007Zu-F1 for emacs-devel@gnu.org; Sun, 22 Jan 2006 19:41:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F0pjD-00037X-Tp for emacs-devel@gnu.org; Sun, 22 Jan 2006 19:38:39 -0500 Original-Received: from [63.240.77.81] (helo=sccrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1F0pn3-0003S8-2J; Sun, 22 Jan 2006 19:42:37 -0500 Original-Received: from raeburn.org (c-65-96-168-237.hsd1.ma.comcast.net[65.96.168.237]) by comcast.net (sccrmhc11) with ESMTP id <2006012300350501100qn5eue>; Mon, 23 Jan 2006 00:35:05 +0000 Original-Received: from [18.101.0.226] (laptop.raeburn.org [18.101.0.226]) by raeburn.org (8.12.11/8.12.11) with ESMTP id k0N0Z4CV002847; Sun, 22 Jan 2006 19:35:04 -0500 (EST) In-Reply-To: <87u0bw6wwz.fsf-monnier+emacs@gnu.org> Original-To: Stefan Monnier X-Mailer: Apple Mail (2.746.2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49420 Archived-At: On Jan 22, 2006, at 11:45, Stefan Monnier wrote: >> if you look at x_catch_errors, you'll see that it allocates one >> lisp_cons >> cell, one lisp_string and one lisp_misc. Whether it's the cause >> of the >> bugs we see, I don't know, but since it's run from the signal >> handler, it >> can be executed at potentially any time. > > The patch below should remove this particular problem. > @@ -7495,16 +7500,23 @@ > Display *dpy; > { > int count = SPECPDL_INDEX (); > + struct x_error_message_stack *data = malloc (sizeof (*data)); It may just push the memory corruption from the Lisp object pool to the malloc pool, since malloc isn't safe for signal handlers either. Is it possible to pre-allocate this storage on a per-display basis, or might we have to deal with multiple error messages from one server without a chance to do processing outside of the signal handler? Ken