Corinna Vinschen
2008-10-28 16:08:09 UTC
Hi,
I'm not sure if there's another, better suited managed newsgroup for
this kind of problem. I opened a support case at Microsoft Professional
Support yesterday, but they refused to take it because the actual
problem (the crash) doesn't occur in a Windows component. The support
engineer suggested to ask in one of the managed newsgroups, so here we
are.
Months ago I tweaked Cygwin so that it works on Windows Server 2008.
There was a single problem with SEH which has been discussed in this
newsgroup back then. After this has been fixed, Cygwin worked nicely on
Server 2008. Once in while a Cygwin user claimed that Cygwin's bash
crashes on their 2008 machines, but since I was never able to reproduce
the problem, I doubted that this had anything to do with Cygwin itself.
Last week a Cygwin user noted that Cygwin's bash crashes as soon as
Terminal Services have been installed on Server 2008. I tested this
observation and could reproduce it. Bash, as well as some other
applications (GDB, grep) crash, but most other applications still run
fine. I started to debug this phenomenon and what happens is this:
The crash occurs in plain application code, not in the Cygwin DLL. The
application's main() function calls some arbitrary other application
function and the first assembler instruction in this called function
crashes with a STATUS_ACCESS_VIOLATION. Analyzing this exception with
WinDbg shows that the reason for the SEGV is an "Attempt to execute
non-executable address XYZ", with XYZ the address of the first (and
crashing) assembler instruction in the called function.
The address in question is well within the .text segment of the
executable. There's no visible reason why this address should be a
non-executable address.
As it turned out, this weird crash only occurs when the application is
running with DEP switched on (default on Server 2008) *and* Terminal
Services are installed. If you switch off DEP, or you deinstall
Terminal Services, the crash doesn't occur. It doesn't matter whether
Terminal Services are running or not, just the fact that they are
installed is sufficient to trigger the crash. You can deinstall and
reinstall TS multiple times and the behaviour is reproducible, no crash
without TS, crash with TS. It also does not matter whether you install
Cygwin before TS is installed or afterwards. Cygwin has no dependencies
to special TS properties anyway.
For testing purposes I switched off parts of the Cygwin initialization
code one at a time, for instance installing SEH handler, Ctrl-C handler,
stuff like that, but to no avail.
So, now I'm at a loss what to look for. I have a hacky workaround which
is to switch off DEP in the Cygwin initialization code, but that's
really just a hack, IMO. Of course that only works if DEP is running in
OptOut mode.
Any help, *especially* (but not only) from Microsoft, would be really
appreciated.
Corinna
I'm not sure if there's another, better suited managed newsgroup for
this kind of problem. I opened a support case at Microsoft Professional
Support yesterday, but they refused to take it because the actual
problem (the crash) doesn't occur in a Windows component. The support
engineer suggested to ask in one of the managed newsgroups, so here we
are.
Months ago I tweaked Cygwin so that it works on Windows Server 2008.
There was a single problem with SEH which has been discussed in this
newsgroup back then. After this has been fixed, Cygwin worked nicely on
Server 2008. Once in while a Cygwin user claimed that Cygwin's bash
crashes on their 2008 machines, but since I was never able to reproduce
the problem, I doubted that this had anything to do with Cygwin itself.
Last week a Cygwin user noted that Cygwin's bash crashes as soon as
Terminal Services have been installed on Server 2008. I tested this
observation and could reproduce it. Bash, as well as some other
applications (GDB, grep) crash, but most other applications still run
fine. I started to debug this phenomenon and what happens is this:
The crash occurs in plain application code, not in the Cygwin DLL. The
application's main() function calls some arbitrary other application
function and the first assembler instruction in this called function
crashes with a STATUS_ACCESS_VIOLATION. Analyzing this exception with
WinDbg shows that the reason for the SEGV is an "Attempt to execute
non-executable address XYZ", with XYZ the address of the first (and
crashing) assembler instruction in the called function.
The address in question is well within the .text segment of the
executable. There's no visible reason why this address should be a
non-executable address.
As it turned out, this weird crash only occurs when the application is
running with DEP switched on (default on Server 2008) *and* Terminal
Services are installed. If you switch off DEP, or you deinstall
Terminal Services, the crash doesn't occur. It doesn't matter whether
Terminal Services are running or not, just the fact that they are
installed is sufficient to trigger the crash. You can deinstall and
reinstall TS multiple times and the behaviour is reproducible, no crash
without TS, crash with TS. It also does not matter whether you install
Cygwin before TS is installed or afterwards. Cygwin has no dependencies
to special TS properties anyway.
For testing purposes I switched off parts of the Cygwin initialization
code one at a time, for instance installing SEH handler, Ctrl-C handler,
stuff like that, but to no avail.
So, now I'm at a loss what to look for. I have a hacky workaround which
is to switch off DEP in the Cygwin initialization code, but that's
really just a hack, IMO. Of course that only works if DEP is running in
OptOut mode.
Any help, *especially* (but not only) from Microsoft, would be really
appreciated.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat