Changeset 2936 in kBuild for trunk/src/kWorker
- Timestamp:
- Sep 18, 2016 8:47:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/kWorker.c
r2935 r2936 7036 7036 * Thread/Fiber local storage leak prevention. 7037 7037 * 7038 * Note! The FlsAlloc/Free causes problems for statically linked VS20107039 * code like VBoxBs3ObjConverter.exe. One thing is that we're7040 * leaking these indexes, but more importantely we crash during7038 * Note! The FlsAlloc/Free & TlsAlloc/Free causes problems for statically 7039 * linked VS2010 code like VBoxBs3ObjConverter.exe. One thing is that 7040 * we're leaking these indexes, but more importantely we crash during 7041 7041 * worker exit since the callback is triggered multiple times. 7042 7042 */ … … 7092 7092 { 7093 7093 pTracker->idx = FLS_OUT_OF_INDEXES; 7094 pTracker->pNext = NULL; 7095 kHlpFree(pTracker); 7096 } 7097 } 7098 } 7099 return fRc; 7100 } 7101 7102 7103 /** Kernel32 - TlsAlloc */ 7104 DWORD WINAPI kwSandbox_Kernel32_TlsAlloc(VOID) 7105 { 7106 DWORD idxTls = TlsAlloc(); 7107 KW_LOG(("TlsAlloc() -> %#x\n", idxTls)); 7108 if (idxTls != TLS_OUT_OF_INDEXES) 7109 { 7110 PKWLOCALSTORAGE pTracker = (PKWLOCALSTORAGE)kHlpAlloc(sizeof(*pTracker)); 7111 if (pTracker) 7112 { 7113 kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); 7114 pTracker->idx = idxTls; 7115 pTracker->pNext = g_Sandbox.pTlsAllocHead; 7116 g_Sandbox.pTlsAllocHead = pTracker; 7117 } 7118 } 7119 7120 return idxTls; 7121 } 7122 7123 /** Kernel32 - TlsFree */ 7124 BOOL WINAPI kwSandbox_Kernel32_TlsFree(DWORD idxTls) 7125 { 7126 BOOL fRc = TlsFree(idxTls); 7127 KW_LOG(("TlsFree(%#x) -> %d\n", idxTls, fRc)); 7128 if (fRc) 7129 { 7130 PKWLOCALSTORAGE pTracker; 7131 kHlpAssert(GetCurrentThreadId() == g_Sandbox.idMainThread); 7132 7133 pTracker = g_Sandbox.pTlsAllocHead; 7134 if (pTracker) 7135 { 7136 if (pTracker->idx == idxTls) 7137 g_Sandbox.pTlsAllocHead = pTracker->pNext; 7138 else 7139 { 7140 PKWLOCALSTORAGE pPrev; 7141 do 7142 { 7143 pPrev = pTracker; 7144 pTracker = pTracker->pNext; 7145 } while (pTracker && pTracker->idx != idxTls); 7146 if (pTracker) 7147 pPrev->pNext = pTracker->pNext; 7148 } 7149 if (pTracker) 7150 { 7151 pTracker->idx = TLS_OUT_OF_INDEXES; 7094 7152 pTracker->pNext = NULL; 7095 7153 kHlpFree(pTracker); … … 7599 7657 { TUPLE("FlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_FlsAlloc }, 7600 7658 { TUPLE("FlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_FlsFree }, 7659 { TUPLE("TlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_TlsAlloc }, 7660 { TUPLE("TlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_TlsFree }, 7601 7661 7602 7662 { TUPLE("SetConsoleCtrlHandler"), NULL, (KUPTR)kwSandbox_Kernel32_SetConsoleCtrlHandler }, … … 7755 7815 { TUPLE("FlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_FlsAlloc }, 7756 7816 { TUPLE("FlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_FlsFree }, 7817 { TUPLE("TlsAlloc"), NULL, (KUPTR)kwSandbox_Kernel32_TlsAlloc }, 7818 { TUPLE("TlsFree"), NULL, (KUPTR)kwSandbox_Kernel32_TlsFree }, 7757 7819 }; 7758 7820 /** Number of entries in g_aSandboxGetProcReplacements. */
Note:
See TracChangeset
for help on using the changeset viewer.