Module: wine Branch: master Commit: eaad2380003777fa3036d9e7286f02d82a15064a URL: https://source.winehq.org/git/wine.git/?a=commit;h=eaad2380003777fa3036d9e72...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Apr 20 00:02:29 2020 +0200
ntdll: Leave critical section before blocking in RtlWaitOnAddress.
Fixes regression from commit 4f673d5386f44d4af4459a95b3059cfb887db8c9.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/exception.c | 4 ++-- dlls/ntdll/ntdll_misc.h | 2 +- dlls/ntdll/server.c | 9 +++++++-- dlls/ntdll/sync.c | 4 +--- 4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index 87341654ba..5df037b7ea 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -114,7 +114,7 @@ void wait_suspend( CONTEXT *context ) int saved_errno = errno;
/* wait with 0 timeout, will only return once the thread is no longer suspended */ - server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, context, NULL ); + server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, context, NULL, NULL );
errno = saved_errno; } @@ -159,7 +159,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con { select_op.wait.op = SELECT_WAIT; select_op.wait.handles[0] = handle; - server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, &exception_context, NULL ); + server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, &exception_context, NULL, NULL );
SERVER_START_REQ( get_exception_status ) { diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 964953e27d..eaed3cc1fc 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -117,7 +117,7 @@ extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN; extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN; extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN; extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags, - timeout_t abs_timeout, CONTEXT *context, user_apc_t *user_apc ) DECLSPEC_HIDDEN; + timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs, user_apc_t *user_apc ) DECLSPEC_HIDDEN; extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN; extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 3de5a93556..c0dd0f35fc 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -602,7 +602,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result ) * server_select */ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags, - timeout_t abs_timeout, CONTEXT *context, user_apc_t *user_apc ) + timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs, user_apc_t *user_apc ) { unsigned int ret; int cookie; @@ -660,6 +660,11 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT size = offsetof( select_op_t, signal_and_wait.signal ); } pthread_sigmask( SIG_SETMASK, &old_set, NULL ); + if (cs) + { + RtlLeaveCriticalSection( cs ); + cs = NULL; + } if (ret != STATUS_PENDING) break;
ret = wait_select_reply( &cookie ); @@ -692,7 +697,7 @@ unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT f
for (;;) { - ret = server_select( select_op, size, flags, abs_timeout, NULL, &apc ); + ret = server_select( select_op, size, flags, abs_timeout, NULL, NULL, &apc ); if (ret != STATUS_USER_APC) break; invoke_apc( &apc );
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index d3927a05af..fbfb8f893e 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -2584,9 +2584,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size select_op.keyed_event.handle = wine_server_obj_handle( keyed_event ); select_op.keyed_event.key = wine_server_client_ptr( addr );
- ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, NULL ); - RtlLeaveCriticalSection( &addr_section ); - return ret; + return server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, &addr_section, NULL ); }
/***********************************************************************