From e2750d967a17e3540c8a227fa21dcf8d44a5bdfe Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 3 Apr 2017 03:17:52 +0200 Subject: [PATCH] Rebase against 42ed54b5d8e67aeb647d5a4fc8af7c8962285c7f. --- patches/kernel32-Named_Pipe/definition | 1 + ...-conditions-with-write-watches-in-Nt.patch | 60 +++++--- patches/ntdll-WriteWatches/definition | 2 +- patches/patchinstall.sh | 134 ++++-------------- ...eference-to-the-parent-object-for-pi.patch | 50 +++---- patches/server-Pipe_ObjectName/definition | 3 +- ...e-conditions-of-async-WSARecv-operat.patch | 15 +- 7 files changed, 108 insertions(+), 157 deletions(-) diff --git a/patches/kernel32-Named_Pipe/definition b/patches/kernel32-Named_Pipe/definition index bcf21676..a2edc632 100644 --- a/patches/kernel32-Named_Pipe/definition +++ b/patches/kernel32-Named_Pipe/definition @@ -3,3 +3,4 @@ Fixes: Improve ReadDataAvailable handling in FilePipeLocalInformation class Fixes: Set NamedPipeState to FILE_PIPE_CLOSING_STATE on broken pipe in NtQueryInformationFile FIxes: Return proper status codes when NtReadFile/NtWriteFile is called on closed (but not disconnected) pipe Depends: server-Desktop_Refcount +Disabled: true diff --git a/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch b/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch index 5161fde5..5a378fd5 100644 --- a/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch +++ b/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch @@ -1,19 +1,19 @@ -From 8f87412b097475e203ad9aa5289f35905c4a8327 Mon Sep 17 00:00:00 2001 +From d587367c1f1e2dbe9b284b32027db068691838eb Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 10 Feb 2015 06:36:52 +0100 Subject: ntdll: Avoid race-conditions with write watches in NtReadFile. Rebased against kernel32-NamedPipe patchset by Sebastian Lackner . --- - dlls/kernel32/tests/virtual.c | 8 ++++---- - dlls/ntdll/file.c | 5 +++++ - 2 files changed, 9 insertions(+), 4 deletions(-) + dlls/kernel32/tests/virtual.c | 8 ++++---- + dlls/ntdll/file.c | 18 ++++++++++++++++++ + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c -index e80ba38..29740b5 100644 +index 40de97ada2..4765cd6c58 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c -@@ -1637,16 +1637,16 @@ static void test_write_watch(void) +@@ -1722,16 +1722,16 @@ static void test_write_watch(void) num_bytes = 0; success = GetOverlappedResult( readpipe, &overlapped, &num_bytes, TRUE ); @@ -35,28 +35,48 @@ index e80ba38..29740b5 100644 CloseHandle( readpipe ); CloseHandle( writepipe ); diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 15500b9..1f35a55 100644 +index c153e7bb5c..34fd08fb0b 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -627,6 +627,8 @@ static NTSTATUS read_unix_fd(int fd, char *buf, ULONG *total, ULONG length, - else - return STATUS_PENDING; +@@ -514,6 +514,10 @@ static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb, + { + if (errno == EAGAIN || errno == EINTR) + status = STATUS_PENDING; ++ else if (errno == EFAULT) ++ status = (wine_uninterrupted_write_memory( &fileio->buffer[fileio->already], NULL, ++ fileio->count - fileio->already ) >= (fileio->count - fileio->already)) ? ++ STATUS_PENDING : STATUS_ACCESS_VIOLATION; + else /* check to see if the transfer is complete */ + status = FILE_GetNtStatus(); } -+ else if (errno == EFAULT && wine_uninterrupted_write_memory( buf + *total, NULL, length - *total ) >= (length - *total)) -+ continue; - else if (errno != EINTR) - return FILE_GetNtStatus(); - } -@@ -968,6 +970,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, +@@ -875,6 +879,13 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, /* async I/O doesn't make sense on regular files */ while ((result = pread( unix_handle, buffer, length, offset->QuadPart )) == -1) { -+ if (errno == EFAULT && virtual_check_buffer_for_write( buffer, length )) -+ continue; -+ ++ if (errno == EFAULT) ++ { ++ if (virtual_check_buffer_for_write( buffer, length ) >= length) ++ continue; ++ else ++ errno = EFAULT; ++ } if (errno != EINTR) { status = FILE_GetNtStatus(); +@@ -949,6 +960,13 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, + else if (errno != EAGAIN) + { + if (errno == EINTR) continue; ++ if (errno == EFAULT) ++ { ++ if (wine_uninterrupted_write_memory( (char *)buffer + total, NULL, length - total ) >= (length - total)) ++ continue; ++ else ++ errno = EFAULT; ++ } + if (!total) status = FILE_GetNtStatus(); + goto done; + } -- -2.6.1 +2.11.0 diff --git a/patches/ntdll-WriteWatches/definition b/patches/ntdll-WriteWatches/definition index 28425d72..592f6edf 100644 --- a/patches/ntdll-WriteWatches/definition +++ b/patches/ntdll-WriteWatches/definition @@ -1,3 +1,3 @@ Fixes: Avoid race-conditions in NtReadFile() operations with write watches. Depends: ws2_32-WriteWatches -Depends: kernel32-Named_Pipe +# Depends: kernel32-Named_Pipe diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 82b5b5f4..9874d423 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "ec8485ec10e3c27b89ec5f1289bc8a3cdad5f3f6" + echo "42ed54b5d8e67aeb647d5a4fc8af7c8962285c7f" } # Show version information @@ -187,7 +187,6 @@ patch_enable_all () enable_kernel32_Locale_Definitions="$1" enable_kernel32_Misalign_Workaround="$1" enable_kernel32_MoveFile="$1" - enable_kernel32_Named_Pipe="$1" enable_kernel32_NeedCurrentDirectoryForExePath="$1" enable_kernel32_PE_Loader_Fixes="$1" enable_kernel32_Processor_Group="$1" @@ -786,9 +785,6 @@ patch_enable () kernel32-MoveFile) enable_kernel32_MoveFile="$2" ;; - kernel32-Named_Pipe) - enable_kernel32_Named_Pipe="$2" - ;; kernel32-NeedCurrentDirectoryForExePath) enable_kernel32_NeedCurrentDirectoryForExePath="$2" ;; @@ -2165,10 +2161,10 @@ if test "$enable_server_Realtime_Priority" -eq 1; then fi if test "$enable_server_Pipe_ObjectName" -eq 1; then - if test "$enable_kernel32_Named_Pipe" -gt 1; then - abort "Patchset kernel32-Named_Pipe disabled, but server-Pipe_ObjectName depends on that." + if test "$enable_server_Desktop_Refcount" -gt 1; then + abort "Patchset server-Desktop_Refcount disabled, but server-Pipe_ObjectName depends on that." fi - enable_kernel32_Named_Pipe=1 + enable_server_Desktop_Refcount=1 fi if test "$enable_server_Object_Types" -eq 1; then @@ -2267,13 +2263,9 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then fi if test "$enable_ntdll_WriteWatches" -eq 1; then - if test "$enable_kernel32_Named_Pipe" -gt 1; then - abort "Patchset kernel32-Named_Pipe disabled, but ntdll-WriteWatches depends on that." - fi if test "$enable_ws2_32_WriteWatches" -gt 1; then abort "Patchset ws2_32-WriteWatches disabled, but ntdll-WriteWatches depends on that." fi - enable_kernel32_Named_Pipe=1 enable_ws2_32_WriteWatches=1 fi @@ -2373,13 +2365,6 @@ if test "$enable_kernel32_PE_Loader_Fixes" -eq 1; then enable_kernel32_Misalign_Workaround=1 fi -if test "$enable_kernel32_Named_Pipe" -eq 1; then - if test "$enable_server_Desktop_Refcount" -gt 1; then - abort "Patchset server-Desktop_Refcount disabled, but kernel32-Named_Pipe depends on that." - fi - enable_server_Desktop_Refcount=1 -fi - if test "$enable_kernel32_GetPackageFullName" -eq 1; then if test "$enable_api_ms_win_Stub_DLLs" -gt 1; then abort "Patchset api-ms-win-Stub_DLLs disabled, but kernel32-GetPackageFullName depends on that." @@ -4632,89 +4617,6 @@ if test "$enable_kernel32_MoveFile" -eq 1; then ) >> "$patchlist" fi -# Patchset server-Desktop_Refcount -# | -# | Modified files: -# | * dlls/user32/tests/winstation.c, dlls/user32/winstation.c, include/winuser.h, programs/explorer/desktop.c, -# | server/async.c, server/atom.c, server/change.c, server/clipboard.c, server/completion.c, server/console.c, -# | server/debugger.c, server/device.c, server/directory.c, server/event.c, server/fd.c, server/file.c, server/handle.c, -# | server/handle.h, server/hook.c, server/mailslot.c, server/mapping.c, server/mutex.c, server/named_pipe.c, -# | server/object.c, server/object.h, server/process.c, server/queue.c, server/registry.c, server/request.c, -# | server/semaphore.c, server/serial.c, server/signal.c, server/snapshot.c, server/sock.c, server/symlink.c, -# | server/thread.c, server/timer.c, server/token.c, server/winstation.c -# | -if test "$enable_server_Desktop_Refcount" -eq 1; then - patch_apply server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch - patch_apply server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch - patch_apply server-Desktop_Refcount/0003-user32-Implement-CWF_CREATE_ONLY-flag-for-CreateWind.patch - patch_apply server-Desktop_Refcount/0004-server-Assign-random-name-when-no-name-was-passed-to.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "server: Introduce a new alloc_handle object callback.", 2 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Track desktop handle count more correctly.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "user32: Implement CWF_CREATE_ONLY flag for CreateWindowStation.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Assign random name when no name was passed to create_winstation.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset kernel32-Named_Pipe -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * server-Desktop_Refcount -# | -# | This patchset fixes the following Wine bugs: -# | * [#17195] Support for named pipe message mode (Linux only) -# | -# | Modified files: -# | * dlls/kernel32/file.c, dlls/kernel32/sync.c, dlls/kernel32/tests/pipe.c, dlls/ntdll/file.c, include/winternl.h, -# | server/named_pipe.c, server/protocol.def, server/sock.c, server/sock.h -# | -if test "$enable_kernel32_Named_Pipe" -eq 1; then - patch_apply kernel32-Named_Pipe/0001-kernel32-tests-Only-allow-one-test-result.patch - patch_apply kernel32-Named_Pipe/0002-kernel32-tests-Add-tests-for-PeekNamedPipe-with-part.patch - patch_apply kernel32-Named_Pipe/0003-kernel32-tests-Add-tests-for-sending-and-receiving-l.patch - patch_apply kernel32-Named_Pipe/0004-server-Show-warning-if-message-mode-is-not-supported.patch - patch_apply kernel32-Named_Pipe/0005-ntdll-Unify-similar-code-in-NtReadFile-and-FILE_Asyn.patch - patch_apply kernel32-Named_Pipe/0006-ntdll-Move-logic-to-check-for-broken-pipe-into-a-sep.patch - patch_apply kernel32-Named_Pipe/0007-ntdll-Unify-similar-code-in-NtWriteFile-and-FILE_Asy.patch - patch_apply kernel32-Named_Pipe/0008-server-Use-SOCK_SEQPACKET-socket-in-combination-with.patch - patch_apply kernel32-Named_Pipe/0009-ntdll-Add-handling-for-partially-received-messages-i.patch - patch_apply kernel32-Named_Pipe/0010-kernel32-tests-Add-more-tests-with-overlapped-IO-and.patch - patch_apply kernel32-Named_Pipe/0011-ntdll-Fix-some-tests-for-overlapped-partial-reads.patch - patch_apply kernel32-Named_Pipe/0012-kernel32-tests-Test-sending-peeking-and-receiving-an.patch - patch_apply kernel32-Named_Pipe/0013-ntdll-Add-support-for-nonblocking-pipes.patch - patch_apply kernel32-Named_Pipe/0014-kernel32-tests-Add-tests-for-PIPE_NOWAIT-in-message-.patch - patch_apply kernel32-Named_Pipe/0015-ntdll-Allow-to-set-PIPE_NOWAIT-on-byte-mode-pipes.patch - patch_apply kernel32-Named_Pipe/0016-kernel32-tests-Add-additional-tests-for-PIPE_NOWAIT-.patch - patch_apply kernel32-Named_Pipe/0017-ntdll-Improve-ReadDataAvailable-handling-in-FilePipe.patch - patch_apply kernel32-Named_Pipe/0018-ntdll-Set-NamedPipeState-to-FILE_PIPE_CLOSING_STATE-.patch - patch_apply kernel32-Named_Pipe/0019-server-Return-correct-error-codes-for-NtWriteFile-wh.patch - patch_apply kernel32-Named_Pipe/0020-ntdll-Pre-cache-file-descriptors-after-opening-a-fil.patch - patch_apply kernel32-Named_Pipe/0021-server-Do-not-allow-to-queue-async-operation-for-bro.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Only allow one test result.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Add tests for PeekNamedPipe with partial received messages.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Add tests for sending and receiving large messages.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Show warning if message mode is not supported.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Unify similar code in NtReadFile and FILE_AsyncReadService.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Move logic to check for broken pipe into a separate function.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Unify similar code in NtWriteFile and FILE_AsyncWriteService.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Use SOCK_SEQPACKET socket in combination with SO_PEEK_OFF to implement message mode on Unix.", 6 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add handling for partially received messages in NtReadFile.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Add more tests with overlapped IO and partial reads from named pipes.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Fix some tests for overlapped partial reads.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Test sending, peeking and receiving an empty message.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add support for nonblocking pipes.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Add tests for PIPE_NOWAIT in message mode.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Allow to set PIPE_NOWAIT on byte-mode pipes.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "kernel32/tests: Add additional tests for PIPE_NOWAIT in overlapped mode.", 1 },'; - printf '%s\n' '+ { "Qian Hong", "ntdll: Improve ReadDataAvailable handling in FilePipeLocalInformation class support.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Set NamedPipeState to FILE_PIPE_CLOSING_STATE on broken pipe in NtQueryInformationFile.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Return correct error codes for NtWriteFile when pipes are closed without disconnecting.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Pre-cache file descriptors after opening a file.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "server: Do not allow to queue async operation for broken pipes.", 1 },'; - ) >> "$patchlist" -fi - # Patchset kernel32-NeedCurrentDirectoryForExePath # | # | This patchset fixes the following Wine bugs: @@ -6017,7 +5919,7 @@ fi # Patchset ntdll-WriteWatches # | # | This patchset has the following (direct or indirect) dependencies: -# | * server-Desktop_Refcount, kernel32-Named_Pipe, ws2_32-WriteWatches +# | * ws2_32-WriteWatches # | # | Modified files: # | * dlls/kernel32/tests/virtual.c, dlls/ntdll/file.c @@ -6629,6 +6531,30 @@ if test "$enable_server_ClipCursor" -eq 1; then ) >> "$patchlist" fi +# Patchset server-Desktop_Refcount +# | +# | Modified files: +# | * dlls/user32/tests/winstation.c, dlls/user32/winstation.c, include/winuser.h, programs/explorer/desktop.c, +# | server/async.c, server/atom.c, server/change.c, server/clipboard.c, server/completion.c, server/console.c, +# | server/debugger.c, server/device.c, server/directory.c, server/event.c, server/fd.c, server/file.c, server/handle.c, +# | server/handle.h, server/hook.c, server/mailslot.c, server/mapping.c, server/mutex.c, server/named_pipe.c, +# | server/object.c, server/object.h, server/process.c, server/queue.c, server/registry.c, server/request.c, +# | server/semaphore.c, server/serial.c, server/signal.c, server/snapshot.c, server/sock.c, server/symlink.c, +# | server/thread.c, server/timer.c, server/token.c, server/winstation.c +# | +if test "$enable_server_Desktop_Refcount" -eq 1; then + patch_apply server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch + patch_apply server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch + patch_apply server-Desktop_Refcount/0003-user32-Implement-CWF_CREATE_ONLY-flag-for-CreateWind.patch + patch_apply server-Desktop_Refcount/0004-server-Assign-random-name-when-no-name-was-passed-to.patch + ( + printf '%s\n' '+ { "Sebastian Lackner", "server: Introduce a new alloc_handle object callback.", 2 },'; + printf '%s\n' '+ { "Sebastian Lackner", "server: Track desktop handle count more correctly.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "user32: Implement CWF_CREATE_ONLY flag for CreateWindowStation.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "server: Assign random name when no name was passed to create_winstation.", 1 },'; + ) >> "$patchlist" +fi + # Patchset server-FileEndOfFileInformation # | # | Modified files: @@ -6856,7 +6782,7 @@ fi # Patchset server-Pipe_ObjectName # | # | This patchset has the following (direct or indirect) dependencies: -# | * server-Desktop_Refcount, kernel32-Named_Pipe +# | * server-Desktop_Refcount # | # | Modified files: # | * dlls/ntdll/tests/om.c, server/named_pipe.c, server/object.c, server/object.h diff --git a/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch b/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch index 588828be..1209db43 100644 --- a/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch +++ b/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch @@ -1,4 +1,4 @@ -From 85ccf78e42e8c913c71385fa8ff469d757fb5ffd Mon Sep 17 00:00:00 2001 +From aaeefae082df9cd44092a36d5781de6d6a0fabee Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 17 Aug 2015 01:11:47 +0200 Subject: server: Store a reference to the parent object for pipe servers. (v2) @@ -11,10 +11,10 @@ Subject: server: Store a reference to the parent object for pipe servers. (v2) 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c -index b58f76365f..84b783b80a 100644 +index 43c5ee46d7..9a1ba670ab 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c -@@ -1503,14 +1503,11 @@ static void test_query_object(void) +@@ -1487,14 +1487,11 @@ static void test_query_object(void) status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len ); ok( status == STATUS_SUCCESS , "NtQueryObject returned %x\n", status ); str = (UNICODE_STRING *)buffer; @@ -30,19 +30,19 @@ index b58f76365f..84b783b80a 100644 "name too short %s\n", wine_dbgstr_w(str->Buffer) ); trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len ); diff --git a/server/named_pipe.c b/server/named_pipe.c -index a7811c1185..3d19e6c42c 100644 +index 0d10f11669..2713614776 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c -@@ -169,6 +169,8 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); +@@ -164,6 +164,8 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); /* server end functions */ static void pipe_server_dump( struct object *obj, int verbose ); static struct fd *pipe_server_get_fd( struct object *obj ); +static int pipe_server_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void pipe_server_unlink_name( struct object *obj, struct object_name *name ); - static int pipe_server_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void pipe_server_destroy( struct object *obj); static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int blocking ); -@@ -191,8 +193,8 @@ static const struct object_ops pipe_server_ops = + static enum server_fd_type pipe_server_get_fd_type( struct fd *fd ); +@@ -185,8 +187,8 @@ static const struct object_ops pipe_server_ops = default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ @@ -52,17 +52,17 @@ index a7811c1185..3d19e6c42c 100644 + pipe_server_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_alloc_handle, /* alloc_handle */ - pipe_server_close_handle, /* close_handle */ -@@ -216,6 +218,8 @@ static const struct fd_ops pipe_server_fd_ops = + fd_close_handle, /* close_handle */ +@@ -210,6 +212,8 @@ static const struct fd_ops pipe_server_fd_ops = static void pipe_client_dump( struct object *obj, int verbose ); static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry ); static struct fd *pipe_client_get_fd( struct object *obj ); +static int pipe_client_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void pipe_client_unlink_name( struct object *obj, struct object_name *name ); - static int pipe_client_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void pipe_client_destroy( struct object *obj ); static obj_handle_t pipe_client_flush( struct fd *fd, struct async *async, int blocking ); -@@ -238,8 +242,8 @@ static const struct object_ops pipe_client_ops = + static obj_handle_t pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, +@@ -231,8 +235,8 @@ static const struct object_ops pipe_client_ops = default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ @@ -72,8 +72,8 @@ index a7811c1185..3d19e6c42c 100644 + pipe_client_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_alloc_handle, /* alloc_handle */ - pipe_client_close_handle, /* close_handle */ -@@ -486,6 +490,17 @@ static void pipe_end_destroy( struct pipe_end *pipe_end ) + fd_close_handle, /* close_handle */ +@@ -484,6 +488,17 @@ static void pipe_end_destroy( struct pipe_end *pipe_end ) free_async_queue( pipe_end->write_q ); } @@ -88,10 +88,10 @@ index a7811c1185..3d19e6c42c 100644 +{ +} + - static int pipe_server_close_handle( struct object *obj, struct process *process, obj_handle_t handle ) + static void pipe_server_destroy( struct object *obj) { - #ifdef __linux__ -@@ -532,6 +547,17 @@ static void pipe_server_destroy( struct object *obj) + struct pipe_server *server = (struct pipe_server *)obj; +@@ -513,6 +528,17 @@ static void pipe_server_destroy( struct object *obj) release_object( server->pipe ); } @@ -106,10 +106,10 @@ index a7811c1185..3d19e6c42c 100644 +{ +} + - static int pipe_client_close_handle( struct object *obj, struct process *process, obj_handle_t handle ) + static void pipe_client_destroy( struct object *obj) { - #ifdef __linux__ -@@ -1003,9 +1029,10 @@ static void init_pipe_end( struct pipe_end *pipe_end, unsigned int pipe_flags, d + struct pipe_client *client = (struct pipe_client *)obj; +@@ -1072,9 +1098,10 @@ static void init_pipe_end( struct pipe_end *pipe_end, unsigned int pipe_flags, d static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, unsigned int pipe_flags ) { @@ -121,7 +121,7 @@ index a7811c1185..3d19e6c42c 100644 if (!server) return NULL; -@@ -1027,11 +1054,13 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned +@@ -1096,11 +1123,13 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned return server; } @@ -137,17 +137,17 @@ index a7811c1185..3d19e6c42c 100644 if (!client) return NULL; -@@ -1130,7 +1159,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc +@@ -1170,7 +1199,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc return NULL; } - if ((client = create_pipe_client( options, pipe->flags, pipe->outsize ))) + if ((client = create_pipe_client( pipe, options, pipe->flags, pipe->outsize ))) { - type = ((pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && is_messagemode_supported()) ? - SOCK_SEQPACKET : SOCK_STREAM; + if (use_server_io( &server->pipe_end )) + { diff --git a/server/object.c b/server/object.c -index 2ce1cdcd56..37ac0adce6 100644 +index 46f020e522..653687d5bf 100644 --- a/server/object.c +++ b/server/object.c @@ -176,7 +176,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) @@ -201,7 +201,7 @@ index 2ce1cdcd56..37ac0adce6 100644 /* dump the name of an object to stderr */ diff --git a/server/object.h b/server/object.h -index 9ff123ebff..4a5d282a47 100644 +index 72ad8528c5..ddb4410525 100644 --- a/server/object.h +++ b/server/object.h @@ -135,6 +135,8 @@ extern WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ); diff --git a/patches/server-Pipe_ObjectName/definition b/patches/server-Pipe_ObjectName/definition index 14e6e8ea..13393a8e 100644 --- a/patches/server-Pipe_ObjectName/definition +++ b/patches/server-Pipe_ObjectName/definition @@ -1,2 +1,3 @@ Fixes: Report correct ObjectName for NamedPipe wineserver objects -Depends: kernel32-Named_Pipe +# Depends: kernel32-Named_Pipe +Depends: server-Desktop_Refcount diff --git a/patches/ws2_32-WriteWatches/0002-ws2_32-Avoid-race-conditions-of-async-WSARecv-operat.patch b/patches/ws2_32-WriteWatches/0002-ws2_32-Avoid-race-conditions-of-async-WSARecv-operat.patch index f184e08f..39434603 100644 --- a/patches/ws2_32-WriteWatches/0002-ws2_32-Avoid-race-conditions-of-async-WSARecv-operat.patch +++ b/patches/ws2_32-WriteWatches/0002-ws2_32-Avoid-race-conditions-of-async-WSARecv-operat.patch @@ -1,4 +1,4 @@ -From 1fa875d307b456f103fd9ab225fe4b5a6272e602 Mon Sep 17 00:00:00 2001 +From 252e65f38146194200160b94bf2b4c1963980a07 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 21 Nov 2014 12:22:46 +0100 Subject: ws2_32: Avoid race-conditions of async WSARecv() operations with @@ -37,14 +37,14 @@ Based on the code it looks like we could savely remove the write-watch check at the beginning of WS2_recv_base, which might make the application think that data is immediately available. --- - dlls/ws2_32/socket.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) + dlls/ws2_32/socket.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index 4444011..e287c2b 100644 +index d13fbf4da4..a532c2591d 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -2014,7 +2014,17 @@ static int WS2_recv( int fd, struct ws2_async *wsa, int flags ) +@@ -2332,7 +2332,20 @@ static int WS2_recv( int fd, struct ws2_async *wsa, int flags ) while ((n = recvmsg(fd, &hdr, flags)) == -1) { @@ -56,7 +56,10 @@ index 4444011..e287c2b 100644 + { + struct iovec *iov = &wsa->iovec[i]; + if (wine_uninterrupted_write_memory( iov->iov_base, NULL, iov->iov_len ) < iov->iov_len) ++ { ++ errno = EFAULT; + return -1; ++ } + } + } + else if (errno != EINTR) @@ -64,5 +67,5 @@ index 4444011..e287c2b 100644 } -- -2.3.3 +2.11.0