LdrpModuleDatatableLock and other ntdll mechanisms can cause a deadlock after thread freezing
praydog opened this issue · 1 comments
praydog commented
Shortly before this, I freeze the threads with SafetyhookFactory::acquire()
. In one of the functions I call while threads are frozen, I am calling this function:
std::optional<HMODULE> get_module_within(Address address) {
HMODULE module = nullptr;
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, address.as<LPCSTR>(), &module)) {
return module;
}
return {};
}
This is the offending mutex in ntdll:
For now, I've gotten around this by acquiring in multiple places instead of in one giant code block, to limit the potential that I will run into this issue.
cursey commented
Should be fixed with latest changes. Reopen if you continue to experience this issue.