[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: musl, printf out-of-memory test
From: |
Bruno Haible |
Subject: |
Re: musl, printf out-of-memory test |
Date: |
Tue, 19 Jun 2012 22:04:57 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
Rich Felker wrote:
> > 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.?
I can reduce the program and the compilation options:
=============================== conftest.c =============================
#include <stdio.h>
#include <errno.h>
int main()
{
int ret;
int err;
ret = printf ("%.5000000f", 1.0);
err = errno;
fprintf (stderr, "printf's return value = %d, errno = %d\n", ret, err);
return !(ret == 5000002 || (ret < 0 && err == ENOMEM));
}
========================================================================
$ musl-gcc -g -Wall conftest.c -o conftest
$ ./conftest > /dev/null ; echo $?
printf's return value = 5000002, errno = 0
0
$ ./conftest > /dev/null ; echo $?
printf's return value = 5000002, errno = 0
0
$ ./conftest > /dev/null ; echo $?
printf's return value = 5000002, errno = 0
0
$ ./conftest > /dev/null ; echo $?
Speicherzugriffsfehler (Speicherabzug geschrieben)
139
$ ./conftest > /dev/null ; echo $?
Speicherzugriffsfehler (Speicherabzug geschrieben)
139
I couldn't get useful info from gdb.
This is on Linux, 32-bit mode on a 64-bit system. Can you reproduce this?
Bruno
- Re: musl bugs found through gnulib, (continued)
- Re: musl bugs found through gnulib, Bruno Haible, 2012/06/17
- Re: [musl] Re: musl bugs found through gnulib, idunham, 2012/06/17
- Re: [musl] Re: musl bugs found through gnulib, Rich Felker, 2012/06/18
- Re: [musl] Re: musl bugs found through gnulib, Eric Blake, 2012/06/18
- Re: [musl] Re: musl bugs found through gnulib, Rich Felker, 2012/06/18
- Re: musl, fdopen test, Bruno Haible, 2012/06/19
- Re: musl, fdopen test, Jim Meyering, 2012/06/19
- Re: musl, fdopen test, Bruno Haible, 2012/06/20
- Re: musl, printf out-of-memory test, Bruno Haible, 2012/06/19
- Re: [musl] Re: musl, printf out-of-memory test, Rich Felker, 2012/06/19
- Re: musl, printf out-of-memory test,
Bruno Haible <=
- Re: musl, printf out-of-memory test, Rich Felker, 2012/06/19
- Re: musl, printf out-of-memory test, Bruno Haible, 2012/06/19
- Re: musl, printf out-of-memory test, Rich Felker, 2012/06/19
- Re: musl, printf out-of-memory test, Bruno Haible, 2012/06/20
- Re: musl, printf out-of-memory test, Jim Meyering, 2012/06/20
- Re: musl, printf out-of-memory test, Tom Tromey, 2012/06/21
- Re: [musl] Re: musl bugs found through gnulib, Rich Felker, 2012/06/19
- Re: [musl] Re: musl bugs found through gnulib, Eric Blake, 2012/06/20
- Re: [musl] Re: musl bugs found through gnulib, Rich Felker, 2012/06/20
- Re: grantpt test, Bruno Haible, 2012/06/22