Module: wine
Branch: master
Commit: d6829bdcbabd5e1a32a2585604eb0aa96b2a6271
URL: https://gitlab.winehq.org/wine/wine/-/commit/d6829bdcbabd5e1a32a2585604eb0a…
Author: Martin Storsjö <martin(a)martin.st>
Date: Wed Nov 23 14:41:14 2022 +0200
ntdll: Avoid accidentally picking up ntdll's __wine_unix_call_funcs for other DLLs.
When f7332ab4a6e199d03e4318d82c0b16a0396b935c switched load_so_dll
over to a proper Unix syscall, ntdll.so started providing the
symbol __wine_unix_call_funcs.
When a DLL calls NtQueryVirtualMemory(MemoryWineUnixFuncs), it can
do so speculatively, not knowing whether the corresponding unix
lib actually does provide anything.
When ntdll.so started providing this symbol, then such speculative
calls to NtQueryVirtualMemory(MemoryWineUnixFuncs) would end up
returning ntdll's __wine_unix_call_funcs if the intended DLL's
unix library lacked one.
This is the case with bcrypt, where the unix library doesn't
provide __wine_unix_call_funcs if gnutls is unavailable.
This fixes crashes after f7332ab4a6e199d03e4318d82c0b16a0396b935c,
in builds without gnutls.
Signed-off-by: Martin Storsjö <martin(a)martin.st>
---
dlls/ntdll/unix/unix_private.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index a7fae7ab7ab..aad472faff8 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -43,8 +43,8 @@ static const WORD current_machine = IMAGE_FILE_MACHINE_ARM64;
extern WORD native_machine DECLSPEC_HIDDEN;
extern HMODULE ntdll_module DECLSPEC_HIDDEN;
-extern const unixlib_entry_t __wine_unix_call_funcs[];
-extern const unixlib_entry_t __wine_unix_call_wow64_funcs[];
+extern const unixlib_entry_t __wine_unix_call_funcs[] DECLSPEC_HIDDEN;
+extern const unixlib_entry_t __wine_unix_call_wow64_funcs[] DECLSPEC_HIDDEN;
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));