Re: Segfault in getenv

From: Måns Rullgård (mru_at_inprovide.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 20:19:08 +0100

Bruno Barberi Gnecco <brunobgDELETETHIS@users.sourceforge.net> writes:

> Måns Rullgård wrote:
>
> Hi Måns!
>
>>> I'm developing a threaded application that is segfaulting, for
>>>no apparent reason, at getenv. Here's a typical stack trace:

[...]

>>> getenv is never called directly from the program. The bug is
>>>easily reproduceable, which makes me doubt that there's a racing
>>>condition. Any ideas of what might be going on? Is there some known
>>>problem of reentrancy in getenv? (BTW, gethostname_r does not work
>>>either, with the same bug and stack trace of gethostname).
>> Can you produce the same error in a short test program? If yes, post
>> it, otherwise get valgrind up and running.
>
> I can post the code, but it would require downloading the
> library. It's on the CVS, actually (libglass.sf.net, file
> test/general/autotestgeneral)... It is a short test program.
> Valgrind did not help at all. I'm wondering if it is not
> a libc bug...

If you suspect a libc bug, try to isolate a simple test case that
triggers it. More often than not, you'll end up finding the bug in
your own code instead.

-- 
Måns Rullgård
mru@inprovide.com


Relevant Pages

  • [PATCH 0/6] epoll fixes and cleanups
    ... This bug has the potential to confuse ... The test program uses a thread blocked in readto keep the struct ... Patches #2 and #3 fix some minor issues; ... I would like to have patch #1 included in 2.6.29 and -stable. ...
    (Linux-Kernel)
  • Re: [PATCH] mremap NULL pointer dereference fix
    ... To trigger the bug, I have to run my test program in a "while true;" ... > extra goto in the generated assembly unless the compiler is clever enough ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Detecting stack corruption
    ... > a module loader to it. ... but the test program I wrote ... Valgrind is very good at finding things like ... Erik de Castro Lopo nospam@mega-nerd.com ...
    (comp.os.linux.development.apps)
  • weird error message after gnat installation
    ... i made this simple test program ... procedure test is begin null; end; ... | Use a subject line meaningful to you and us to track the bug. ... i retried the download and the install but no change. ...
    (comp.lang.ada)
  • Re: Problem using Ada.Text_IO.Modular_IO
    ... However, when compile my little test program, ... with the GNAT 4.3.1 on a 32bit Ubuntu-Linux machine. ... I guess that this is a bug. ...
    (comp.lang.ada)