|
|
Message-ID: <20120619200847.GR163@brightrain.aerifal.cx>
Date: Tue, 19 Jun 2012 16:08:47 -0400
From: Rich Felker <dalias@...ifal.cx>
To: Bruno Haible <bruno@...sp.org>
Cc: bug-gnulib@....org, musl@...ts.openwall.com
Subject: Re: musl, printf out-of-memory test
On Tue, Jun 19, 2012 at 10:04:57PM +0200, Bruno Haible wrote:
> 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?
I can't reproduce it. Do you have a dynamic-linked musl or just
static? I tried both and couldn't reproduce with either. Did you set
resource limits before running it? Are you using any strange kernel
mods? I once heard of a patched kernel setting up other mappings over
top of the not-yet-expanded-into stack space, but I'd be surprised if
more weren't breaking on such a system...
What happened in gdb? Were you unable to get it to crash? What if you
run it under strace?
Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.