Subject: [boost] boost.context cause strange crash on certan WIN32 API
From: microcai (microcai_at_[hidden])
Date: 2014-11-28 09:15:23
Hi, I was using Boost.Asio.Spawn happliy until I ported my project to windows.
I got stange openssl crash. many debug days speeded and there was nothing
wrong with openssl.
Strange thing is, openssl didn't crash when used in normal code, unless I used
them in asio stackful coroutine.
Now I finnally find the root cause and make it 100% reproducible.
here is the code that demostrade the crash:
HMODULE advapi = LoadLibrary(TEXT("advapi32")); // crash there
boost::context::jump_fcontext(fc1, &fcm, 0);
fc1=boost::context::make_fcontext(sp1, size, f1);
boost::context::jump_fcontext(&fcm, fc1, 0);
the context created in threads other that main thread, can't call certain
APIs. If LoadLibrary get called by an context that created in thread, it will
100% reproducible on WIN64 platform with MSVC2013.
And nothing wrong on WIN32 !
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk