Frame-based exception handling problem on Server 2008

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

while testing Cygwin on Server 2008, I encountered a couple of spurious
hangs in OS functions, taking as much CPU it can get. This happens only
on Server 2008, both, 32 and 64 bit version, but it does not happen on
any other Windows version, up to and including Vista SP1.

Debugging turned up that Server 2008 has apparently a problem with
Cygwin's exception handling.

Usually, when using frame-based exception handling, the exception
handlers are organized via a linked list on the stack, starting at the
address referenced by the register %fs:0, using a structure like this.

typedef struct exception_list
{
struct exception_list *prev;
exception_handler *handler;
};

This is used by Cygwin, too, but with a tweak. There is only one
exception_list entry on the stack (not counting the default handler).
This entry is generated before the application's entry function is
called, and at creation time of any thread. The specific tweak is that
the exception prev pointer points back to itself, instead of to the
default handler. This allowed Linux-like signal handling even for
recurring computational exceptions so far in all Windows releases up to
and including Vista SP1, including all 64 bit versions.

However, exactly here's the problem. If the exception handler list is
an endless loop as described above, certain OS calls on Server 2008
simply hang endlessly, taking 100% CPU.

A very simple testcase is a division by zero:

main ()
{
return 1 / 0;
}

This is usually handled by our exception handler by either dumping a
stacktrace or core file, or by calling the applications's signal handler
for SIGFPE.

However, on Server 2008, our exception handler never gets called when
this happens. The process simply hangs, taking whatever CPU it can
grab.

Since this worked for all Windows versions before 2008, and since we're
not interested in the default exception handler taking over for Cygwin,
we would like to know, if there's a chance that this problem could be
fixed in 2008.

Barring that, it would be nice to learn how we can get our old behaviour
back, even if we don't create a exception handler loop, and if possible
in a unified way which works on previous Windows releases as well.


Thanks in advance,
Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
.



Relevant Pages

  • Re: Custom HttpHandler and Server.Transfer
    ... server side processing path for the current request. ... | Subject: Re: Custom HttpHandler and Server.Transfer ... |>methods only addressing transfer to another Page handler, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Frame-based exception handling problem on Server 2008
    ... Is it correct to call RtlUnwind in the exception handler or is ... constantly switching between "unwinding is correct" and "unwinding is ... The simple case is that the application has no signal handler installed. ...
    (microsoft.public.win32.programmer.kernel)
  • PROBLEM: Failure to deliver SIGCHLD
    ... Failure to deliver SIGCHLD ... The server employs a very simple SIGCHLD handler that loops on ... 000c8000-000c97ff: Extension ROM ...
    (Linux-Kernel)
  • Re: [DeepZone Research] Its time to disclose GOLONDRINA Anarchy (draft + exploit included!)
    ... range of well known *minimal* fingerprints *with a closed vulnerability*. ... WWW server fly out pages in this way ... ... execute buggy code protected by exception handler ... IIS will be ...
    (Vuln-Dev)
  • Re: using try catch on linked servers
    ... usually fires the local CATCH handler. ... Or do you mean that the remote procedure continues to run after the ... will trigger the CATCH handler in the local server, ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)