Commit 1a8ae57a61 for qemu.org
commit 1a8ae57a6155bf0d34cc315efcfa38b2251460d3
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Mon Sep 7 14:50:09 2026 +0400
qga/vss-win32: avoid CRT calls in DllMain debug logging
qga_debug() uses vsnprintf, snprintf and fputs while DllMain holds the
loader lock. CRT I/O can deadlock under the loader lock. Replace with
direct OutputDebugStringA calls, which are safe to call from DllMain.
Fixes: 61df91b33caf ("QGA VSS: Add log in functions begin/end")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-11-86456ad356e2@redhat.com
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
index 44c3c74bd2..1c8eb236e5 100644
--- a/qga/vss-win32/provider.cpp
+++ b/qga/vss-win32/provider.cpp
@@ -536,11 +536,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD dwReason, LPVOID lpReserved);
EXTERN_C
BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD dwReason, LPVOID lpReserved)
{
- qga_debug("begin, reason = %lu", dwReason);
+ OutputDebugStringA(QGA_PROVIDER_NAME ": DllMain begin\n");
if (dwReason == DLL_PROCESS_ATTACH) {
g_hinstDll = hinstDll;
DisableThreadLibraryCalls(hinstDll);
}
- qga_debug_end;
+ OutputDebugStringA(QGA_PROVIDER_NAME ": DllMain end\n");
return TRUE;
}