Fix Unix stack overflow trace logging for native failure locations
authorJan Vorlicek <janvorli@microsoft.com>
Thu, 30 Apr 2020 10:24:46 +0000 (12:24 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 30 Apr 2020 15:45:42 +0000 (17:45 +0200)
commit3c9f4357676b63a321b187ee67001a9eb531f37f
tree065be298e33fd0d98cc119f33041df9435253108
parentf185bd5571f2500b4843d145418c4418747246b6
Fix Unix stack overflow trace logging for native failure locations

When stack overflow happens in native runtime code (e.g. in one of the
QCALLs, FCALLs etc.), we do not print stack trace to the console
and we fail fast with just a "Stack overflow" message. The reason is
that the stack overflow handling is executed on the failing thread and
it is not safe to call methods that are not async safe (reentrant).
The reason is that we could end up hanging or crashing when trying to
report the stack overflow.

However, we have the same potential issue on Windows and yet we try to
report the stack trace anyways. So this change modifies the behavior on
Unix to be the same.

I have also added a bunch of stack overflow reporting tests.
src/coreclr/src/pal/src/exception/machexception.cpp
src/coreclr/src/pal/src/exception/seh.cpp
src/coreclr/src/pal/src/exception/signal.cpp
src/coreclr/src/vm/exceptionhandling.cpp
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow.cs [new file with mode: 0644]
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow.csproj [new file with mode: 0644]
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow3.cs [new file with mode: 0644]
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow3.csproj [new file with mode: 0644]
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflowtester.cs [new file with mode: 0644]
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflowtester.csproj [new file with mode: 0644]