Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121217172227.GU20323@brightrain.aerifal.cx>
Date: Mon, 17 Dec 2012 12:22:27 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: LLVM testsuite, close-stderr.ll hangs

On Mon, Dec 17, 2012 at 11:58:29AM -0500, Rich Felker wrote:
> On Mon, Dec 17, 2012 at 03:03:39PM +0400, ojab wrote:
> > On glibc this command exits with code 1, on musl it hangs. strace
> > output can be found in the attached files.
> > [...]
> > 28321 write(2, "LLVM ERROR: IO failure on output stream.\n", 41) = -1 EBADF (Bad file number)
> > 28321 pause(
> 
> The only way pause() is called from exit() is when the exit lock is
> already held. There are 3 basic ways this could happen:
> 
> 1. Memory corruption that overwrote the lock variable.
> 2. Another thread holding the lock indefinitely (e.g. deadlock an an
>    atexit handler).
> 3. Recursive call to exit (i.e. calling exit from an atexit handler or
>    a signal handler.
> 
> Since I don't see any threads in the strace, I'm ruling out #2. #1 is
> definitely an option, but I suspect what's going on is #3, in which
> case it's an llvm bug. Calling exit more than once is undefined
> behavior; in particular, atexit handlers or global destructors cannot
> call exit.

To track this down, you could run under gdb and just interrupt the
program and look at a backtrace once it hangs. This should make it
clear whether exit was called recursively.

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.