From 991bebfee7425974e9150ea73bb93300f65dc70e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 5 Feb 2020 17:42:46 -0600 Subject: [PATCH] Rebase against 9642f35922b79cebacdc774eb54619e389ccd531. --- ...er-Add-commandline-option-check-libs.patch | 24 +-- ...retrieving-DOS-attributes-in-NtQuery.patch | 20 +-- ...unctions-for-managing-free-area-list.patch | 16 +- ...-support-for-junction-point-creation.patch | 38 ++-- ...-signals-while-executing-system-APCs.patch | 165 ------------------ patches/ntdll-Wait_User_APC/definition | 1 - patches/patchinstall.sh | 44 ++--- ...-support-for-global-and-local-shared.patch | 48 ++--- patches/server-Shared_Memory/definition | 1 - 9 files changed, 83 insertions(+), 274 deletions(-) delete mode 100644 patches/ntdll-Wait_User_APC/0001-ntdll-Block-signals-while-executing-system-APCs.patch delete mode 100644 patches/ntdll-Wait_User_APC/definition diff --git a/patches/Staging/0004-loader-Add-commandline-option-check-libs.patch b/patches/Staging/0004-loader-Add-commandline-option-check-libs.patch index 51728b4f..7c95e5e6 100644 --- a/patches/Staging/0004-loader-Add-commandline-option-check-libs.patch +++ b/patches/Staging/0004-loader-Add-commandline-option-check-libs.patch @@ -1,4 +1,4 @@ -From 540ee9ebdee96f7c67224bfae699375c8cb4c90c Mon Sep 17 00:00:00 2001 +From 5c9a371d0da2f0835ab86afb4f9264634a993375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 28 May 2014 19:50:51 +0200 Subject: [PATCH] loader: Add commandline option --check-libs. @@ -12,7 +12,7 @@ Subject: [PATCH] loader: Add commandline option --check-libs. 5 files changed, 213 insertions(+), 1 deletion(-) diff --git a/include/wine/library.h b/include/wine/library.h -index 511bf4722a0..557cec20cf8 100644 +index 511bf4722..557cec20c 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -44,6 +44,7 @@ extern "C" { @@ -32,7 +32,7 @@ index 511bf4722a0..557cec20cf8 100644 extern void *wine_dlsym( void *handle, const char *symbol, char *error, size_t errorsize ); extern int wine_dlclose( void *handle, char *error, size_t errorsize ); diff --git a/libs/wine/config.c b/libs/wine/config.c -index 5b66c063db6..e0988513e14 100644 +index 5b66c063d..e0988513e 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c @@ -470,6 +470,130 @@ const char *wine_get_build_dir(void) @@ -167,7 +167,7 @@ index 5b66c063db6..e0988513e14 100644 const char *wine_get_server_dir(void) { diff --git a/libs/wine/loader.c b/libs/wine/loader.c -index 2a569f5b739..5f10c3f9d3e 100644 +index 2a569f5b7..5f10c3f9d 100644 --- a/libs/wine/loader.c +++ b/libs/wine/loader.c @@ -1072,6 +1072,42 @@ void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize @@ -214,27 +214,27 @@ index 2a569f5b739..5f10c3f9d3e 100644 * wine_dlsym */ diff --git a/libs/wine/wine.map b/libs/wine/wine.map -index 5edee0d9235..8e3382168d5 100644 +index 13b8d4715..3cfd3a24c 100644 --- a/libs/wine/wine.map +++ b/libs/wine/wine.map -@@ -16,6 +16,7 @@ WINE_1.0 +@@ -13,6 +13,7 @@ WINE_1.0 + wine_cp_get_table; + wine_cp_mbstowcs; wine_cp_wcstombs; - wine_cpsymbol_mbstowcs; - wine_cpsymbol_wcstombs; + wine_dladdr; wine_dlclose; wine_dll_enum_load_path; wine_dll_set_callback; -@@ -32,6 +33,7 @@ WINE_1.0 +@@ -28,6 +29,7 @@ WINE_1.0 wine_get_es; wine_get_fs; wine_get_gs; + wine_get_libs; wine_get_server_dir; - wine_get_sortkey; wine_get_ss; + wine_get_user_name; diff --git a/loader/main.c b/loader/main.c -index f6629128de1..a2dc40c51cc 100644 +index f6629128d..a2dc40c51 100644 --- a/loader/main.c +++ b/loader/main.c @@ -36,6 +36,12 @@ @@ -309,5 +309,5 @@ index f6629128de1..a2dc40c51cc 100644 -- -2.17.1 +2.25.0 diff --git a/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch b/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch index 188c6ce2..eed05cc6 100644 --- a/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch +++ b/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch @@ -1,4 +1,4 @@ -From 77a43be1f24d8fbbdb500b6ee89b20673f9704e7 Mon Sep 17 00:00:00 2001 +From f9369606cc5094d85f35a5d27f0bcaab4ebd7d68 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Tue, 19 Aug 2014 22:10:49 -0600 Subject: [PATCH] ntdll: Implement retrieving DOS attributes in @@ -14,7 +14,7 @@ Subject: [PATCH] ntdll: Implement retrieving DOS attributes in create mode 100644 libs/port/xattr.c diff --git a/configure.ac b/configure.ac -index f6d520c59ef..19dadd2063c 100644 +index cc77413d2..a4742777b 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,7 @@ AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwi @@ -25,7 +25,7 @@ index f6d520c59ef..19dadd2063c 100644 AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]), -@@ -704,6 +705,17 @@ AC_CHECK_HEADERS([libprocstat.h],,, +@@ -686,6 +687,17 @@ AC_CHECK_HEADERS([libprocstat.h],,, #include #endif]) @@ -44,7 +44,7 @@ index f6d520c59ef..19dadd2063c 100644 AC_SUBST(DLLFLAGS,"-D_REENTRANT") diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 8aaf7b982ba..ae8fd77bea8 100644 +index cce5811c9..046a05859 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -127,6 +127,22 @@ static const WCHAR ntfsW[] = {'N','T','F','S'}; @@ -71,7 +71,7 @@ index 8aaf7b982ba..ae8fd77bea8 100644 static inline ULONG get_file_attributes( const struct stat *st ) { diff --git a/include/wine/port.h b/include/wine/port.h -index 92a3a362ddb..8fec3a34591 100644 +index a7ddd4a05..62d8112a9 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -356,6 +356,14 @@ int usleep (unsigned int useconds); @@ -90,19 +90,19 @@ index 92a3a362ddb..8fec3a34591 100644 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in -index b050686ba0f..447c1939078 100644 +index 33445fa76..021c36b34 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in -@@ -110,4 +110,5 @@ C_SRCS = \ +@@ -102,4 +102,5 @@ C_SRCS = \ + symlink.c \ usleep.c \ - utf8.c \ wctomb.c \ - wctype.c + wctype.c \ + xattr.c diff --git a/libs/port/xattr.c b/libs/port/xattr.c new file mode 100644 -index 00000000000..94b77132bbf +index 000000000..94b77132b --- /dev/null +++ b/libs/port/xattr.c @@ -0,0 +1,39 @@ @@ -146,5 +146,5 @@ index 00000000000..94b77132bbf +#endif +} -- -2.24.1 +2.25.0 diff --git a/patches/ntdll-ForceBottomUpAlloc/0005-libs-wine-Add-functions-for-managing-free-area-list.patch b/patches/ntdll-ForceBottomUpAlloc/0005-libs-wine-Add-functions-for-managing-free-area-list.patch index 86d8823c..f8a5ab56 100644 --- a/patches/ntdll-ForceBottomUpAlloc/0005-libs-wine-Add-functions-for-managing-free-area-list.patch +++ b/patches/ntdll-ForceBottomUpAlloc/0005-libs-wine-Add-functions-for-managing-free-area-list.patch @@ -1,4 +1,4 @@ -From 76d0bfce8f6fec167e44afefc63dbbf4e52beda2 Mon Sep 17 00:00:00 2001 +From 11d770c9800f37a9148b776836fdb24f8c43d403 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jan 2020 21:28:57 +0300 Subject: [PATCH] libs/wine: Add functions for managing free area list. @@ -10,10 +10,10 @@ Subject: [PATCH] libs/wine: Add functions for managing free area list. 3 files changed, 67 insertions(+), 17 deletions(-) diff --git a/include/wine/library.h b/include/wine/library.h -index 557cec20cf8..46d65328a91 100644 +index a6fe28059..006c59ba3 100644 --- a/include/wine/library.h +++ b/include/wine/library.h -@@ -79,6 +79,11 @@ extern int wine_mmap_is_in_reserved_area( void *addr, size_t size ); +@@ -76,6 +76,11 @@ extern int wine_mmap_is_in_reserved_area( void *addr, size_t size ); extern int wine_mmap_enum_reserved_areas( int (*enum_func)(void *base, size_t size, void *arg), void *arg, int top_down ); @@ -26,7 +26,7 @@ index 557cec20cf8..46d65328a91 100644 /* LDT management */ diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c -index f2b5adc1d29..baa466c7766 100644 +index f2b5adc1d..baa466c77 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -52,7 +52,9 @@ struct reserved_area @@ -240,10 +240,10 @@ index f2b5adc1d29..baa466c7766 100644 + return wine_mmap_enum_areas(&free_areas_list, enum_func, arg, top_down); +} diff --git a/libs/wine/wine.map b/libs/wine/wine.map -index 8e3382168d5..8d367d7b756 100644 +index f0c94a950..3fc30237e 100644 --- a/libs/wine/wine.map +++ b/libs/wine/wine.map -@@ -59,6 +59,10 @@ WINE_1.0 +@@ -51,6 +51,10 @@ WINE_1.0 wine_mmap_enum_reserved_areas; wine_mmap_is_in_reserved_area; wine_mmap_remove_reserved_area; @@ -253,7 +253,7 @@ index 8e3382168d5..8d367d7b756 100644 + wine_mmap_remove_free_area; wine_set_fs; wine_set_gs; - wine_utf8_mbstowcs; + wine_wctype_table; -- -2.17.1 +2.25.0 diff --git a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch index 53878a65..66b3239b 100644 --- a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch +++ b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch @@ -1,4 +1,4 @@ -From 71e4fd5717018ba31e37382a0d5eb67cd4b6d5d0 Mon Sep 17 00:00:00 2001 +From d91c1cf1b74e811f3c07dac6261e59de412bc5a8 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 20:56:49 -0700 Subject: ntdll: Add support for junction point creation. @@ -18,10 +18,10 @@ Signed-off-by: Erich E. Hoover create mode 100644 libs/port/renameat2.c diff --git a/configure.ac b/configure.ac -index ef7af7021a..6453cf2697 100644 +index e06743c2e..cc77413d2 100644 --- a/configure.ac +++ b/configure.ac -@@ -2119,6 +2119,8 @@ AC_CHECK_FUNCS(\ +@@ -2152,6 +2152,8 @@ AC_CHECK_FUNCS(\ pwrite \ readdir \ readlink \ @@ -31,7 +31,7 @@ index ef7af7021a..6453cf2697 100644 select \ setproctitle \ diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 1cbaa1b293..693caecffa 100644 +index 26acc066c..ab2f5743c 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -21,6 +21,7 @@ @@ -50,7 +50,7 @@ index 1cbaa1b293..693caecffa 100644 WINE_DEFAULT_DEBUG_CHANNEL(ntdll); WINE_DECLARE_DEBUG_CHANNEL(winediag); -@@ -1639,6 +1641,104 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, +@@ -1640,6 +1642,104 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, } @@ -155,7 +155,7 @@ index 1cbaa1b293..693caecffa 100644 /************************************************************************** * NtFsControlFile [NTDLL.@] * ZwFsControlFile [NTDLL.@] -@@ -1723,6 +1823,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -1724,6 +1824,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc io->Information = 0; status = STATUS_SUCCESS; break; @@ -181,7 +181,7 @@ index 1cbaa1b293..693caecffa 100644 return server_ioctl_file( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 8e54dbb541..322dadefe3 100644 +index 539ce44e0..12dea7aea 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -38,6 +38,7 @@ @@ -192,7 +192,7 @@ index 8e54dbb541..322dadefe3 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -4831,6 +4832,105 @@ static void test_file_readonly_access(void) +@@ -4900,6 +4901,105 @@ static void test_file_readonly_access(void) DeleteFileW(path); } @@ -298,17 +298,17 @@ index 8e54dbb541..322dadefe3 100644 START_TEST(file) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); -@@ -4900,4 +5000,5 @@ START_TEST(file) +@@ -4970,4 +5070,5 @@ START_TEST(file) test_query_attribute_information_file(); test_ioctl(); test_flush_buffers_file(); + test_reparse_points(); } diff --git a/include/Makefile.in b/include/Makefile.in -index 979695f552..2a1382e811 100644 +index a91372eb4..f6dd100dd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in -@@ -482,6 +482,7 @@ SOURCES = \ +@@ -494,6 +494,7 @@ SOURCES = \ ntddvdeo.h \ ntdef.h \ ntdsapi.h \ @@ -318,7 +318,7 @@ index 979695f552..2a1382e811 100644 ntsecapi.h \ diff --git a/include/ntifs.h b/include/ntifs.h new file mode 100644 -index 0000000000..21d42e1732 +index 000000000..21d42e173 --- /dev/null +++ b/include/ntifs.h @@ -0,0 +1,42 @@ @@ -365,10 +365,10 @@ index 0000000000..21d42e1732 + +#endif /* __WINE_NTIFS_H */ diff --git a/include/wine/port.h b/include/wine/port.h -index d23e2b033f..26c5890ddb 100644 +index feb055865..a7ddd4a05 100644 --- a/include/wine/port.h +++ b/include/wine/port.h -@@ -317,6 +317,15 @@ double rint(double x); +@@ -329,6 +329,15 @@ double rint(double x); float rintf(float x); #endif @@ -385,20 +385,20 @@ index d23e2b033f..26c5890ddb 100644 int statvfs( const char *path, struct statvfs *buf ); #endif diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in -index a2e96d1500..db27249ac1 100644 +index 74b6dcfb6..33445fa76 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in -@@ -97,6 +97,7 @@ C_SRCS = \ +@@ -92,6 +92,7 @@ C_SRCS = \ pread.c \ pwrite.c \ readlink.c \ + renameat2.c \ rint.c \ - sortkey.c \ spawn.c \ + statvfs.c \ diff --git a/libs/port/renameat2.c b/libs/port/renameat2.c new file mode 100644 -index 0000000000..f46f407ec7 +index 000000000..f46f407ec --- /dev/null +++ b/libs/port/renameat2.c @@ -0,0 +1,55 @@ @@ -458,5 +458,5 @@ index 0000000000..f46f407ec7 +} +#endif /* HAVE_RENAMEAT2 */ -- -2.17.1 +2.25.0 diff --git a/patches/ntdll-Wait_User_APC/0001-ntdll-Block-signals-while-executing-system-APCs.patch b/patches/ntdll-Wait_User_APC/0001-ntdll-Block-signals-while-executing-system-APCs.patch deleted file mode 100644 index 91001beb..00000000 --- a/patches/ntdll-Wait_User_APC/0001-ntdll-Block-signals-while-executing-system-APCs.patch +++ /dev/null @@ -1,165 +0,0 @@ -From ed9fbc71ad357fe633abb5da5aba1ffddcd09a33 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Wed, 4 Nov 2015 07:30:36 +0100 -Subject: ntdll: Block signals while executing system APCs. (v2) - -Changes in v2: - * Do not delete the still valid comment "Return TRUE if a user APC has been run.". - I still had this deleted from an earlier version of the patchset, where the - return type was changed. - -If a USR1 suspend signal arrives between dequeing a system APC and sending -back the result to the wineserver, a deadlock occurs. To avoid this issue -this patch blocks all signals in server_select(), except while waiting or -processing user APCs. - -In server_queue_process_apc() we do not need to block signals because no -other process will wait on the result. - -Signed-off-by: Sebastian Lackner ---- - dlls/kernel32/tests/sync.c | 11 ++--------- - dlls/ntdll/ntdll_misc.h | 2 +- - dlls/ntdll/server.c | 21 +++++++++++++++++---- - dlls/ntdll/sync.c | 2 +- - 4 files changed, 21 insertions(+), 15 deletions(-) - -diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c -index f7be51e972..982a6ae105 100644 ---- a/dlls/kernel32/tests/sync.c -+++ b/dlls/kernel32/tests/sync.c -@@ -2604,21 +2604,14 @@ static void test_apc_deadlock(void) - result = WaitForSingleObject(event, 1000); - ok(result == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", result); - -- for (i = 0; i < 1000 && info.running; i++) -+ for (i = 0; i < 1000; i++) - { - result = SuspendThread(pi.hThread); - ok(result == 0, "expected 0, got %u\n", result); - - WaitForSingleObject(event, 0); /* reset event */ - result = WaitForSingleObject(event, 1000); -- if (result == WAIT_TIMEOUT) -- { -- todo_wine -- ok(result == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", result); -- info.running = FALSE; -- } -- else -- ok(result == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", result); -+ ok(result == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", result); - - result = ResumeThread(pi.hThread); - ok(result == 1, "expected 1, got %u\n", result); -diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 1630978f0a..3c7411e6d6 100644 ---- a/dlls/ntdll/ntdll_misc.h -+++ b/dlls/ntdll/ntdll_misc.h -@@ -105,7 +105,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o - data_size_t *ret_len ) DECLSPEC_HIDDEN; - extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN; - extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN; --extern BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN; -+extern BOOL invoke_apc( const apc_call_t *call, apc_result_t *result, sigset_t *user_sigset ) DECLSPEC_HIDDEN; - - /* module handling */ - extern LIST_ENTRY tls_links DECLSPEC_HIDDEN; -diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c -index 38356f4674..8944508f85 100644 ---- a/dlls/ntdll/server.c -+++ b/dlls/ntdll/server.c -@@ -385,8 +385,9 @@ int wait_select_reply( void *cookie ) - * invoke_apc - * - * Invoke a single APC. Return TRUE if a user APC has been run. -+ * Optionally unblock signals while executing user APCs. - */ --BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) -+BOOL invoke_apc( const apc_call_t *call, apc_result_t *result, sigset_t *user_sigset ) - { - BOOL user_apc = FALSE; - SIZE_T size; -@@ -401,15 +402,19 @@ BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) - case APC_USER: - { - void (WINAPI *func)(ULONG_PTR,ULONG_PTR,ULONG_PTR) = wine_server_get_ptr( call->user.func ); -+ if (user_sigset) pthread_sigmask( SIG_SETMASK, user_sigset, NULL ); - func( call->user.args[0], call->user.args[1], call->user.args[2] ); -+ if (user_sigset) pthread_sigmask( SIG_BLOCK, &server_block_set, user_sigset ); - user_apc = TRUE; - break; - } - case APC_TIMER: - { - void (WINAPI *func)(void*, unsigned int, unsigned int) = wine_server_get_ptr( call->timer.func ); -+ if (user_sigset) pthread_sigmask( SIG_SETMASK, user_sigset, NULL ); - func( wine_server_get_ptr( call->timer.arg ), - (DWORD)call->timer.time, (DWORD)(call->timer.time >> 32) ); -+ if (user_sigset) pthread_sigmask( SIG_BLOCK, &server_block_set, user_sigset ); - user_apc = TRUE; - break; - } -@@ -595,10 +600,12 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT - obj_handle_t apc_handle = 0; - apc_call_t call; - apc_result_t result; -+ sigset_t old_set; - timeout_t abs_timeout = timeout ? timeout->QuadPart : TIMEOUT_INFINITE; - - memset( &result, 0, sizeof(result) ); - -+ pthread_sigmask( SIG_BLOCK, &server_block_set, &old_set ); - for (;;) - { - SERVER_START_REQ( select ) -@@ -615,9 +622,14 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT - call = reply->call; - } - SERVER_END_REQ; -- if (ret == STATUS_PENDING) ret = wait_select_reply( &cookie ); -+ if (ret == STATUS_PENDING) -+ { -+ pthread_sigmask( SIG_SETMASK, &old_set, NULL ); -+ ret = wait_select_reply( &cookie ); -+ pthread_sigmask( SIG_BLOCK, &server_block_set, &old_set ); -+ } - if (ret != STATUS_USER_APC) break; -- if (invoke_apc( &call, &result )) -+ if (invoke_apc( &call, &result, &old_set )) - { - /* if we ran a user apc we have to check once more if additional apcs are queued, - * but we don't want to wait */ -@@ -630,6 +642,7 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT - if (size >= sizeof(select_op->signal_and_wait) && select_op->op == SELECT_SIGNAL_AND_WAIT) - size = offsetof( select_op_t, signal_and_wait.signal ); - } -+ pthread_sigmask( SIG_SETMASK, &old_set, NULL ); - - if (ret == STATUS_TIMEOUT && user_apc) ret = STATUS_USER_APC; - -@@ -668,7 +681,7 @@ unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, a - - if (self) - { -- invoke_apc( call, result ); -+ invoke_apc( call, result, NULL ); - } - else - { -diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c -index 62cb3cd5ec..a304c9dee4 100644 ---- a/dlls/ntdll/sync.c -+++ b/dlls/ntdll/sync.c -@@ -2039,7 +2039,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size - - if (ret == STATUS_PENDING) ret = wait_select_reply( &cookie ); - if (ret != STATUS_USER_APC) break; -- if (invoke_apc( &call, &result )) -+ if (invoke_apc( &call, &result, NULL )) - { - /* if we ran a user apc we have to check once more if additional apcs are queued, - * but we don't want to wait */ --- -2.14.1 - diff --git a/patches/ntdll-Wait_User_APC/definition b/patches/ntdll-Wait_User_APC/definition deleted file mode 100644 index 34e24838..00000000 --- a/patches/ntdll-Wait_User_APC/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [14697] Do not allow interruption of system APC in server_select diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index a8df8c31..9d9ddea3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "87875e12bcdca659e578849fa62585b1b5316a50" + echo "9642f35922b79cebacdc774eb54619e389ccd531" } # Show version information @@ -220,7 +220,6 @@ patch_enable_all () enable_ntdll_User_Shared_Data="$1" enable_ntdll_User_shared_data_fields="$1" enable_ntdll_WRITECOPY="$1" - enable_ntdll_Wait_User_APC="$1" enable_ntdll_Zero_mod_name="$1" enable_ntdll_aarch_TEB="$1" enable_ntdll_ext4_case_folder="$1" @@ -780,9 +779,6 @@ patch_enable () ntdll-WRITECOPY) enable_ntdll_WRITECOPY="$2" ;; - ntdll-Wait_User_APC) - enable_ntdll_Wait_User_APC="$2" - ;; ntdll-Zero_mod_name) enable_ntdll_Zero_mod_name="$2" ;; @@ -1900,9 +1896,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then if test "$enable_ntdll_Threading" -gt 1; then abort "Patchset ntdll-Threading disabled, but server-Shared_Memory depends on that." fi - if test "$enable_ntdll_Wait_User_APC" -gt 1; then - abort "Patchset ntdll-Wait_User_APC disabled, but server-Shared_Memory depends on that." - fi if test "$enable_server_Key_State" -gt 1; then abort "Patchset server-Key_State disabled, but server-Shared_Memory depends on that." fi @@ -1913,7 +1906,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then abort "Patchset server-Signal_Thread disabled, but server-Shared_Memory depends on that." fi enable_ntdll_Threading=1 - enable_ntdll_Wait_User_APC=1 enable_server_Key_State=1 enable_server_PeekMessage=1 enable_server_Signal_Thread=1 @@ -3636,21 +3628,6 @@ if test "$enable_ntdll_Threading" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-Wait_User_APC -# | -# | This patchset fixes the following Wine bugs: -# | * [#14697] Do not allow interruption of system APC in server_select -# | -# | Modified files: -# | * dlls/kernel32/tests/sync.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/server.c, dlls/ntdll/sync.c -# | -if test "$enable_ntdll_Wait_User_APC" -eq 1; then - patch_apply ntdll-Wait_User_APC/0001-ntdll-Block-signals-while-executing-system-APCs.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Block signals while executing system APCs.", 2 },'; - ) >> "$patchlist" -fi - # Patchset server-Key_State # | # | This patchset fixes the following Wine bugs: @@ -3699,7 +3676,7 @@ fi # Patchset server-Shared_Memory # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-Threading, ntdll-Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread +# | * ntdll-Threading, server-Key_State, server-PeekMessage, server-Signal_Thread # | # | Modified files: # | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/server.c, dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/user32/focus.c, @@ -3751,8 +3728,8 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, ntdll- -# | Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup +# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- +# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup # | # | This patchset fixes the following Wine bugs: # | * [#36692] Many multi-threaded applications have poor performance due to heavy use of synchronization primitives @@ -5516,9 +5493,8 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, ntdll- -# | Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, -# | eventfd_synchronization +# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- +# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization # | # | This patchset fixes the following Wine bugs: # | * [#46967] GOG Galaxy doesn't run in virtual desktop. @@ -5606,7 +5582,7 @@ fi # Patchset server-Object_Types # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-Threading, ntdll-Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory +# | * ntdll-Threading, server-Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory # | # | This patchset fixes the following Wine bugs: # | * [#44629] Process Hacker can't enumerate handles @@ -7425,9 +7401,9 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, ntdll- -# | Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, -# | eventfd_synchronization, server-Desktop_Refcount +# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- +# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization, +# | server-Desktop_Refcount # | # | Modified files: # | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/winsock.h, server/protocol.def, server/sock.c diff --git a/patches/server-Shared_Memory/0002-server-Implement-support-for-global-and-local-shared.patch b/patches/server-Shared_Memory/0002-server-Implement-support-for-global-and-local-shared.patch index 349931b7..7e0bae0e 100644 --- a/patches/server-Shared_Memory/0002-server-Implement-support-for-global-and-local-shared.patch +++ b/patches/server-Shared_Memory/0002-server-Implement-support-for-global-and-local-shared.patch @@ -1,4 +1,4 @@ -From 8e7431126f55f1cfaed86fca2b3a3fea6a3bc1ad Mon Sep 17 00:00:00 2001 +From 2852446d8d31596d8622045d3553c60a953a81ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 19 Mar 2015 01:22:34 +0100 Subject: [PATCH] server: Implement support for global and local shared memory @@ -20,22 +20,22 @@ Subject: [PATCH] server: Implement support for global and local shared memory 12 files changed, 215 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 25051b58fba..10243926bd1 100644 +index 40dc2cd6f..76f0ae971 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -119,6 +119,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o +@@ -116,6 +116,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN; extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN; - extern BOOL invoke_apc( const apc_call_t *call, apc_result_t *result, sigset_t *user_sigset ) DECLSPEC_HIDDEN; + extern void invoke_apc( const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN; +extern void *server_get_shared_memory( HANDLE thread ) DECLSPEC_HIDDEN; /* module handling */ extern LIST_ENTRY tls_links DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c -index cce51683356..72a8ddb1803 100644 +index 4facdc08a..3a26024a9 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c -@@ -1002,6 +1002,66 @@ done: +@@ -998,6 +998,66 @@ done: } @@ -102,7 +102,7 @@ index cce51683356..72a8ddb1803 100644 /*********************************************************************** * wine_server_fd_to_handle (NTDLL.@) * -@@ -1539,6 +1599,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend ) +@@ -1535,6 +1595,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend ) } SERVER_END_REQ; @@ -114,10 +114,10 @@ index cce51683356..72a8ddb1803 100644 ntdll_get_thread_data()->wow64_redir = is_wow64; diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 9c4e84ad313..1eb658ec051 100644 +index 7c3930c58..d80ebe235 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -529,6 +529,7 @@ void exit_thread( int status ) +@@ -366,6 +366,7 @@ void exit_thread( int status ) void WINAPI RtlExitUserThread( ULONG status ) { static void *prev_teb; @@ -125,7 +125,7 @@ index 9c4e84ad313..1eb658ec051 100644 sigset_t sigset; TEB *teb; -@@ -553,6 +554,9 @@ void WINAPI RtlExitUserThread( ULONG status ) +@@ -390,6 +391,9 @@ void WINAPI RtlExitUserThread( ULONG status ) LdrShutdownThread(); RtlFreeThreadActivationContextStack(); @@ -136,7 +136,7 @@ index 9c4e84ad313..1eb658ec051 100644 if ((teb = interlocked_xchg_ptr( &prev_teb, NtCurrentTeb() ))) diff --git a/include/wine/server.h b/include/wine/server.h -index ac5dcc6f8bc..5a845f424c2 100644 +index ac5dcc6f8..5a845f424 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -120,6 +120,17 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) @@ -158,10 +158,10 @@ index ac5dcc6f8bc..5a845f424c2 100644 /* macros for server requests */ diff --git a/include/winternl.h b/include/winternl.h -index b6674d75dd9..e6bc13cbc05 100644 +index e5aed5acb..b6b213a0b 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -401,7 +401,7 @@ typedef struct _TEB +@@ -403,7 +403,7 @@ typedef struct _TEB PVOID ReservedForPerf; /* f7c/1750 */ PVOID ReservedForOle; /* f80/1758 */ ULONG WaitingOnLoaderLock; /* f84/1760 */ @@ -171,10 +171,10 @@ index b6674d75dd9..e6bc13cbc05 100644 #ifdef _WIN64 PVOID DeallocationBStore; /* /1788 */ diff --git a/server/fd.c b/server/fd.c -index ac1c3f85a16..575e88a54f4 100644 +index 5d80e218b..87d7047a1 100644 --- a/server/fd.c +++ b/server/fd.c -@@ -2634,6 +2634,33 @@ DECL_HANDLER(write) +@@ -2568,6 +2568,33 @@ DECL_HANDLER(write) release_object( fd ); } @@ -209,7 +209,7 @@ index ac1c3f85a16..575e88a54f4 100644 DECL_HANDLER(ioctl) { diff --git a/server/file.h b/server/file.h -index 4341ad3b040..da9e6b788c2 100644 +index 4341ad3b0..da9e6b788 100644 --- a/server/file.h +++ b/server/file.h @@ -166,6 +166,14 @@ extern struct object *create_mailslot_device( struct object *root, const struct @@ -228,10 +228,10 @@ index 4341ad3b040..da9e6b788c2 100644 extern void do_change_notify( int unix_fd ); diff --git a/server/main.c b/server/main.c -index ee8cadde5da..313039a3082 100644 +index 26986d34b..4499d6871 100644 --- a/server/main.c +++ b/server/main.c -@@ -147,6 +147,7 @@ int main( int argc, char *argv[] ) +@@ -144,6 +144,7 @@ int main( int argc, char *argv[] ) init_signals(); init_directories(); init_registry(); @@ -240,7 +240,7 @@ index ee8cadde5da..313039a3082 100644 return 0; } diff --git a/server/mapping.c b/server/mapping.c -index 6990a1913d7..3d794bfaaf9 100644 +index 6990a1913..3d794bfaa 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -29,8 +29,32 @@ @@ -341,7 +341,7 @@ index 6990a1913d7..3d794bfaaf9 100644 static int create_temp_file( file_pos_t size ) { diff --git a/server/protocol.def b/server/protocol.def -index 4e1f1f8ad5f..623871dd6dc 100644 +index 6c44b2b43..d3e41247c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -69,6 +69,15 @@ struct request_max_size @@ -360,7 +360,7 @@ index 4e1f1f8ad5f..623871dd6dc 100644 /* debug event data */ typedef union -@@ -1321,6 +1330,12 @@ enum server_fd_type +@@ -1320,6 +1329,12 @@ enum server_fd_type @END @@ -374,7 +374,7 @@ index 4e1f1f8ad5f..623871dd6dc 100644 @REQ(flush) async_data_t async; /* async I/O parameters */ diff --git a/server/thread.c b/server/thread.c -index f8962221d9a..75679e90faf 100644 +index 7683b6698..77edbcdcd 100644 --- a/server/thread.c +++ b/server/thread.c @@ -204,6 +204,8 @@ static inline void init_thread_structure( struct thread *thread ) @@ -407,7 +407,7 @@ index f8962221d9a..75679e90faf 100644 /* destroy a thread when its refcount is 0 */ diff --git a/server/thread.h b/server/thread.h -index 880419c5924..2037f775370 100644 +index 1256e0da4..bc4ad79b1 100644 --- a/server/thread.h +++ b/server/thread.h @@ -91,6 +91,8 @@ struct thread @@ -420,5 +420,5 @@ index 880419c5924..2037f775370 100644 struct thread_snapshot -- -2.24.0 +2.25.0 diff --git a/patches/server-Shared_Memory/definition b/patches/server-Shared_Memory/definition index f1a2cd50..0e6bd7e4 100644 --- a/patches/server-Shared_Memory/definition +++ b/patches/server-Shared_Memory/definition @@ -5,4 +5,3 @@ Depends: ntdll-Threading Depends: server-Key_State Depends: server-PeekMessage Depends: server-Signal_Thread -Depends: ntdll-Wait_User_APC