From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.bugs Subject: bug#18222: 24.3.92; fork handlers in gmalloc.c can lead to deadlock Date: Mon, 25 Aug 2014 08:28:59 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <53E4CC0B.2060200@cornell.edu> <53E67553.9090102@cornell.edu> <53E82787.7030505@cornell.edu> <53E8E145.3090307@cornell.edu> <53F8BA88.4030904@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1408923030 27429 80.91.229.3 (24 Aug 2014 23:30:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Aug 2014 23:30:30 +0000 (UTC) Cc: Peter Hull , 18222@debbugs.gnu.org To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 25 01:30:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XLhEp-0004xz-3p for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Aug 2014 01:30:19 +0200 Original-Received: from localhost ([::1]:45589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLhEo-0001zp-Kd for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Aug 2014 19:30:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLhEg-0001uS-3A for bug-gnu-emacs@gnu.org; Sun, 24 Aug 2014 19:30:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLhEa-00017H-KH for bug-gnu-emacs@gnu.org; Sun, 24 Aug 2014 19:30:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLhEa-000169-G4 for bug-gnu-emacs@gnu.org; Sun, 24 Aug 2014 19:30:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XLhEZ-0008Dx-S2 for bug-gnu-emacs@gnu.org; Sun, 24 Aug 2014 19:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: YAMAMOTO Mitsuharu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Aug 2014 23:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18222 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18222-submit@debbugs.gnu.org id=B18222.140892294831514 (code B ref 18222); Sun, 24 Aug 2014 23:30:03 +0000 Original-Received: (at 18222) by debbugs.gnu.org; 24 Aug 2014 23:29:08 +0000 Original-Received: from localhost ([127.0.0.1]:51192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XLhDf-0008CA-PW for submit@debbugs.gnu.org; Sun, 24 Aug 2014 19:29:08 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:50413) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XLhDb-0008Bf-GT for 18222@debbugs.gnu.org; Sun, 24 Aug 2014 19:29:05 -0400 Original-Received: from fermat.math.s.chiba-u.ac.jp (fermat [133.82.132.10]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id A57EAC0560; Mon, 25 Aug 2014 08:28:59 +0900 (JST) In-Reply-To: <53F8BA88.4030904@cornell.edu> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?UTF-8?Q?Shij=C5=8D?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:92644 Archived-At: >>>>> On Sat, 23 Aug 2014 12:00:08 -0400, Ken Brown said: > On 8/11/2014 11:29 AM, Ken Brown wrote: >> I'm leaving the bug open, since a better fix is needed for the >> trunk. > I tried to implement Yamamoto Mitsuharu's suggestion of switching to > Cygwin's malloc. I don't see a reasonable way to avoid using > gmalloc.c before dumping, because I think that would require a major > rewrite of unexec, and even then I don't see how to do it. But it > turns out to be easy to make the dumped emacs use Cygwin's malloc, > and this seems to solve all the problems with gmalloc.c that I'm > aware of (patch attached). In particular, there's no need to worry > about making malloc thread-safe. > Most of what's needed for this is not Cygwin-specific, so I've tried > to write it in a general way on the off chance that it's useful for > other platforms that use gmalloc. I've defined a new macro > HYBRID_MALLOC that means "use gmalloc before dumping and the system > malloc after dumping". All the Cygwin-specific code occurs in the > definitions of two macros, DUMPED and ALLOCATED_BEFORE_DUMPING, in > gmalloc.c. > The patch still needs a lot more testing, but I'd like to know if > people think my approach is reasonable. Comments and suggestions > would be appreciated. I would also appreciate it if people who > build emacs on Cygwin would test the patch. I think it's worth trying also on other platforms that use gmalloc. IIRC, the main reason why *BSDs are using gmalloc is their system mallocs are not compatible with unexec. One drawback of this approach is it makes it impossible to dump from a dumped executable. But this limitation already exists on Darwin (OS X), and would not be a big practical issue. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp