From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1198 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general,gmane.comp.lib.gnulib.bugs Subject: Re: Re: musl, printf out-of-memory test Date: Tue, 19 Jun 2012 15:16:50 -0400 Message-ID: <20120619191650.GP163@brightrain.aerifal.cx> References: <20120609230541.47eac2de@newbook> <12545931.v3ALTEUUx8@linuix> <20120619001156.GJ163@brightrain.aerifal.cx> <5041927.IR2Ri05J2P@linuix> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1340133666 11991 80.91.229.3 (19 Jun 2012 19:21:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2012 19:21:06 +0000 (UTC) Cc: bug-gnulib@gnu.org To: musl@lists.openwall.com Original-X-From: musl-return-1199-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 19 21:21:06 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Sh3z3-0000Xd-8l for gllmg-musl@plane.gmane.org; Tue, 19 Jun 2012 21:21:01 +0200 Original-Received: (qmail 24456 invoked by uid 550); 19 Jun 2012 19:21:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24448 invoked from network); 19 Jun 2012 19:21:01 -0000 Content-Disposition: inline In-Reply-To: <5041927.IR2Ri05J2P@linuix> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1198 gmane.comp.lib.gnulib.bugs:31064 Archived-At: On Tue, Jun 19, 2012 at 12:45:50PM +0200, Bruno Haible wrote: > So, the exit code 1 must have come from the crash handler. Without this crash > handler: 7x I get > > configure:8919: checking whether printf survives out-of-memory conditions > configure:8979: /arch/x86-linux/inst-musl/bin/musl-gcc -o conftest -g -O2 -Wall conftest.c >&5 > configure:8982: $? = 0 > printf's return value = 5000002, errno = 0 > configure:8986: $? = 0 > configure:9031: result: yes > > but once I get > > configure:8979: /arch/x86-linux/inst-musl/bin/musl-gcc -o conftest -g -O2 -Wall conftest.c >&5 > configure:8982: $? = 0 > configure:8986: $? = 139 > configure:9031: result: no > > So, apparently, under memory stress, musl's printf has a probability of > between 10% and 50% of crashing with SIGSEGV (139 = 128 + 11). musl's printf does not do anything with memory except using a small constant amount of stack space (a few hundred bytes for non-float, somewhere around 5-7k for floating point). This is completely independent of the width/padding/precision; the implementation actually goes to a good bit of trouble to ensure that it can print any amount of padding efficiently without large or unbounded stack space usage. Is there any way the rlimits put in place could be preventing the stack from expanding beyond even one page the current number of pages, etc.? Rich