From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.devel Subject: Re: please set both MALLOC_PERTURB_ and MALLOC_CHECK_ envvars Date: Fri, 27 May 2011 23:57:40 +0200 Message-ID: <87y61rvmaz.fsf@rho.meyering.net> References: <874o4fx17z.fsf@rho.meyering.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306533470 7547 80.91.229.12 (27 May 2011 21:57:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 27 May 2011 21:57:50 +0000 (UTC) To: Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 27 23:57:46 2011 Return-path: Envelope-to: ged-emacs-devel@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 1QQ52P-00061A-Nn for ged-emacs-devel@m.gmane.org; Fri, 27 May 2011 23:57:45 +0200 Original-Received: from localhost ([::1]:39171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ52P-0002du-ER for ged-emacs-devel@m.gmane.org; Fri, 27 May 2011 17:57:45 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ52M-0002de-O6 for emacs-devel@gnu.org; Fri, 27 May 2011 17:57:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQ52L-00018G-RZ for emacs-devel@gnu.org; Fri, 27 May 2011 17:57:42 -0400 Original-Received: from mx.meyering.net ([82.230.74.64]:55721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ52L-00018B-Kc for emacs-devel@gnu.org; Fri, 27 May 2011 17:57:41 -0400 Original-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id E63F86026C; Fri, 27 May 2011 23:57:40 +0200 (CEST) In-Reply-To: <874o4fx17z.fsf@rho.meyering.net> (Jim Meyering's message of "Fri, 27 May 2011 23:50:08 +0200") Original-Lines: 44 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.230.74.64 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139782 Archived-At: Jim Meyering wrote: > Now, bootstrapping emacs on Fedora 15 x86_64 > (with env settings as below) fails with a segfault. > > If you develop emacs, or even if you just build from sources regularly, > on a glibc-based system, do us all a favor and build with these envvar > settings: > > export MALLOC_PERTURB_=$((RANDOM % 255 + 1)) > export MALLOC_CHECK_=3 > > Why? Because that helps you expose malloc-related problems far earlier. > I've found numerous bugs that way. The trouble is that you have to > be ready to debug, or at least ready to retry with > > env MALLOC_PERTURB_=0 MALLOC_CHECK_=0 make ... > > to see if things work better without protection. > > Until recently, I've been building like this to work around > a problem that I traced back to a commit in emacs several years ago: > > make bootstrap RUN_TEMACS='MALLOC_CHECK_=0 ./temacs' > > However, today, even with that, make bootstrap is failing with a > segfault (in various places) that goes away when I turn off malloc > robustness checking via both variables for the whole process > and not just one of them when running temacs: > > MALLOC_PERTURB_=0 MALLOC_CHECK_=0 make bootstrap > > That suggests a very recent change (within the last 24 hrs) > makes emacs act to differently when MALLOC_PERTURB_=N causes glibc > to scribble nonzero (N) bytes into each just freed buffer. Most of that argument is valid, but I have to confess this time a compiler problem appears to be at fault. To get "make" to succeed, I have to build like this: env MALLOC_CHECK_=0 make CFLAGS=-O0 Use CFLAGS=-O or MALLOC_CHECK_=4 (or anything else in 1..255) and the build segfaults when using the just-built temacs to compile .el files.