From owner-freebsd-current@FreeBSD.ORG Thu Jan 19 02:12:09 2006 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1635F16A41F for ; Thu, 19 Jan 2006 02:12:09 +0000 (GMT) (envelope-from jasone@freebsd.org) Received: from lh.synack.net (lh.synack.net [204.152.188.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8662543D48 for ; Thu, 19 Jan 2006 02:12:08 +0000 (GMT) (envelope-from jasone@freebsd.org) Received: by lh.synack.net (Postfix, from userid 100) id 640085E48DA; Wed, 18 Jan 2006 18:12:08 -0800 (PST) Received: from [192.168.168.203] (moscow-cuda-gen2-68-64-60-20.losaca.adelphia.net [68.64.60.20]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by lh.synack.net (Postfix) with ESMTP id 921FC5E484B; Wed, 18 Jan 2006 18:12:06 -0800 (PST) In-Reply-To: <43CECA2C.6030400@ba2.so-net.ne.jp> References: <200601161150.k0GBoamk010563@locutus.newmillennium.net.au> <91B40C65-A11B-427E-B352-8B6EF8A55864@freebsd.org> <43CECA2C.6030400@ba2.so-net.ne.jp> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/mixed; boundary=Apple-Mail-5-415733034 Message-Id: <6A234191-C4DA-4E1B-BB4D-1F3F8043DDA9@freebsd.org> From: Jason Evans Date: Wed, 18 Jan 2006 18:12:02 -0800 To: SANETO Takanori X-Mailer: Apple Mail (2.746.2) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on lh.synack.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: freebsd@newmillennium.net.au, freebsd-current@FreeBSD.org, robin@isometry.net Subject: Re: Malloc bugs exhibited in ports/mail/dovecot X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2006 02:12:09 -0000 --Apple-Mail-5-415733034 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jan 18, 2006, at 3:07 PM, SANETO Takanori wrote: > I experienced this using malloc.c 1.95. > assert("arenas != NULL") failed in malloc.c:4519. > > To reproduce, build mail/dovecot (under either version of malloc.c) > and > run it under libc of malloc.c rev 1.95. imap-login and pop3-login > dump core. > > My environment is: > FreeBSD 7-CURRENT as of 2006/01/15 (+latest libc including malloc.c > 1.95) > in VMware 4.5.3 > sysctl hw.ncpu = 1 > > % ldd /usr/local/libexec/dovecot/imap-login > /usr/local/libexec/dovecot/imap-login: > libssl.so.4 => /usr/lib/libssl.so.4 (0x2809b000) > libcrypto.so.4 => /lib/libcrypto.so.4 (0x280cc000) > libc.so.6 => /lib/libc.so.6 (0x281d2000) This is due to: 1) A bug in malloc. If malloc() fails the first time it is called, this causes a fatal error rather than returning NULL. This is fixed in revision 1.96 of malloc.c. 2) Low resource limits set by dovecot. malloc extends the heap in increments of 16 MB, and dovecot's resource limits are set low enough that malloc immediately fails. The attached patch to the dovecot port works around this. Another reasonable workaround would be to define _malloc_options to be "k" (or "kk", or ...) in the dovecot source code. A short term (but not generally recommended, since it affects all programs) workaround would be to set /etc/malloc.conf to 'k'. Thanks, Jason --Apple-Mail-5-415733034 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="dovecot.diff" Content-Disposition: attachment; filename=dovecot.diff Index: files/patch-aa =================================================================== RCS file: files/patch-aa diff -N files/patch-aa --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-aa 19 Jan 2006 01:38:02 -0000 @@ -0,0 +1,11 @@ +--- src/master/master-settings.c Tue Dec 6 04:54:30 2005 ++++ ../../work.old/dovecot-1.0.alpha5/src/master/master-settings.c Wed Jan 18 17:33:54 2006 +@@ -271,7 +271,7 @@ + MEMBER(login_chroot) TRUE, + MEMBER(login_greeting_capability) FALSE, + +- MEMBER(login_process_size) 32, ++ MEMBER(login_process_size) 64, + MEMBER(login_processes_count) 3, + MEMBER(login_max_processes_count) 128, + MEMBER(login_max_logging_users) 256, --Apple-Mail-5-415733034 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-5-415733034--