[Gc] Re: WOW64 bug: GetThreadContext() may return stale contents

Henning Makholm makholm at octoshape.com
Mon Jan 31 11:04:17 PST 2011

> > Apparently not, except for instrumenting all mutator threads with
> > code to save their ESP in a place where the GC can find it

> Just thinking out loud...
> 1) GC calls SuspendThread()
> 2) GC calls GetThreadContext() (or whatever it was called)
> 3) Get IP, mark page as writable
> 4) Write jump-instruction to GC-code at IP
> 5) Resume thread

Um, no. If the result from GetThreadContext is stale, then *neither*
ESP *nor* EIP can be trusted.

And even if we could get a good EIP, the thread might be blocked in
the OS and not about to resume executing from that EIP anytime

(Not to speak of the fact that EIP might point to kernel code or
DLL code segments that other processes share).

Henning Makholm
Octoshape ApS

More information about the Gc mailing list