bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [musl] Re: musl, printf out-of-memory test


From: Rich Felker
Subject: Re: [musl] Re: musl, printf out-of-memory test
Date: Tue, 19 Jun 2012 15:16:50 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]