Fix the explicit frames unwinding on Unix
authorJan Vorlicek <janvorli@microsoft.com>
Thu, 18 Feb 2016 22:36:43 +0000 (23:36 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 19 Feb 2016 11:21:20 +0000 (12:21 +0100)
commit0e14371a2638dd27222fd63af6032b5cd1a64add
tree77b53785a63b7fd8259dc01d9e813f85f16c1ece
parent17c8a749b3e1a1af8294b72eb722107b72f4460e
Fix the explicit frames unwinding on Unix

This change fixes a problem when exception unwinds native frames of code that contains
explicit frames. There were two issues. First, the destructor of the explicit frame
base class Frame that was responsible for popping the frames was missing switch to
GC cooperative mode and so it could pop frames that GC was currently walking.
And second, after adding the switch to cooperative mode, it turned out that if a
thread gets blocked in the Frame destructor due to GC and the stack walker tries to
get stack cookie from FrameWithCookie wrapper of a class derived from the Frame,
it fails since the vtable pointer was already reset to the vtable of the base Frame
class and it detects that as an invalid case.

The fix was to add destructors to all final classes derived from Frame and perform
the frame popping from there.
src/vm/frames.cpp
src/vm/frames.h