Port to 3.0 - Fix WSL alternate stack check (#25980)
authorJan Vorlicek <janvorli@microsoft.com>
Wed, 7 Aug 2019 16:15:14 +0000 (18:15 +0200)
committerWilliam Godbe <wigodbe@microsoft.com>
Wed, 7 Aug 2019 16:15:14 +0000 (09:15 -0700)
commit1f03924256d50493a0d61e46b9d36985d256e355
treed1ac51617defa3694bbe34068f267223d614a7ef
parentfe139940e7211be4f631a3a35ede45e350a1d7b9
Port to 3.0 - Fix WSL alternate stack check (#25980)

On WSL, the alternate stack check in sigsegv_handler doesn't work. The
uc_stack members are always zero no matter whether the handler is
executed on an alternate or default stack. So the check to detect
whether we are running on an alternate stack or not is always returning
false on WSL and it prevents NULL reference exceptions from being
handled.
The fix is to introduce an env variable COMPlus_EnableAlternateStackCheck
that can be used to enable the alternate stack check. By default, the
sigsegv_handler is considered to always run on an alternate stack.
src/pal/src/exception/signal.cpp
src/pal/src/include/pal/signal.hpp