[Gc] WOW64 bug: GetThreadContext() may return stale contents
makholm at octoshape.com
Sat Nov 20 16:04:59 PST 2010
> > Just came along this bug report in Microsoft Connect:
> > http://tinyurl.com/2d9cl4x
> > Does this affect the Windows version of the collector as well?
> Probably yes (as ESP of the suspended threads is used to get the stack
> Is any workaround suggested for this?
Apparently not, except for instrumenting all mutator threads with code to
save their ESP in a place where the GC can find it, whenever they call an
OS service that may be implemented using a WoW64 thunk. Which it is clearly
not even within the GC's power to do.
Alternatively, scan the entire mapped stack (which can probably be gotten
hold of somehow) rather than just the part above ESP. That would surely
cause really horrible amounts of excessive retention.
If only it were possible to *detect* that the bug had happened, it would
be much more palatable to fall back to whole-stack scanning in that case.
(It appears to be a fairly short window during which the bug can hit, so
it wouldn't be often that it did). But the linked threads do not suggest
any workable way to do that.
More information about the Gc