mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to avoid race-conditions with write watches in WS2_async_accept.
This commit is contained in:
parent
e8d4cc0cb0
commit
1ffd40e9de
@ -38,9 +38,10 @@ Wine. All those differences are also documented on the
|
||||
Included bug fixes and improvements
|
||||
===================================
|
||||
|
||||
**Bugfixes and features included in the next upcoming release [1]:**
|
||||
**Bugfixes and features included in the next upcoming release [2]:**
|
||||
|
||||
* Avoid race-conditions in NtReadFile() operations with write watches.
|
||||
* Avoid race-conditions with write watches in WS2_async_accept.
|
||||
|
||||
|
||||
**Bugs fixed in Wine Staging 1.7.36 [167]:**
|
||||
|
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -2,6 +2,7 @@ wine-staging (1.7.37) UNRELEASED; urgency=low
|
||||
* Fix a TRACE line in the iphlpapi-TCP_Table patchset.
|
||||
* Update patchset for RtlUnwindEx on x86_64 and fix a second bug.
|
||||
* Added patch to avoid race-conditions in NtReadFile() operations with write watches.
|
||||
* Added patch to avoid race-conditions with write watches in WS2_async_accept.
|
||||
* Removed patches for UTF7 support (accepted upstream).
|
||||
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 08 Feb 2015 20:29:38 +0100
|
||||
|
||||
|
@ -1017,10 +1017,12 @@ if test "$enable_ws2_32_WriteWatches" -eq 1; then
|
||||
patch_apply ws2_32-WriteWatches/0001-ntdll-Handle-write-watches-in-virtual_uninterrupted_.patch
|
||||
patch_apply ws2_32-WriteWatches/0002-ntdll-Expose-wine_uninterrupted_-read-write-_memory-.patch
|
||||
patch_apply ws2_32-WriteWatches/0003-ws2_32-Avoid-race-conditions-of-async-WSARecv-operat.patch
|
||||
patch_apply ws2_32-WriteWatches/0004-ws2_32-Avoid-race-condition-with-write-watches-in-WS.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "ntdll: Handle write watches in virtual_uninterrupted_write_memory.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "ntdll: Expose wine_uninterrupted_[read|write]_memory as exports.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "ws2_32: Avoid race-conditions of async WSARecv() operations with write watches.", 2 },';
|
||||
echo '+ { "Sebastian Lackner", "ws2_32: Avoid race-condition with write watches in WS2_async_accept.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -12,8 +12,7 @@ diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 322c5ed..42c7832 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -364,6 +364,18 @@ typedef struct ws2_accept_async
|
||||
struct ws2_async *read;
|
||||
@@ -365,4 +365,16 @@ typedef struct ws2_accept_async
|
||||
} ws2_accept_async;
|
||||
|
||||
+typedef struct ws2_transmitfile_async
|
||||
@ -30,7 +29,6 @@ index 322c5ed..42c7832 100644
|
||||
+
|
||||
/****************************************************************/
|
||||
|
||||
/* ----------------------------------- internal data */
|
||||
@@ -2511,6 +2523,16 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD
|
||||
buffer = HeapAlloc( GetProcessHeap(), 0, bytes_per_send );
|
||||
if (!buffer) goto cleanup;
|
||||
|
@ -0,0 +1,76 @@
|
||||
From 373361ca2f09176e7c587879703ba176dc1ccb38 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 10 Feb 2015 07:31:21 +0100
|
||||
Subject: ws2_32: Avoid race-condition with write watches in WS2_async_accept.
|
||||
|
||||
---
|
||||
dlls/ws2_32/socket.c | 29 +++++++++++++++++++++--------
|
||||
1 file changed, 21 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 8b34e5b..72bffa5 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -363,4 +363,5 @@ typedef struct ws2_accept_async
|
||||
int remote_len;
|
||||
struct ws2_async *read;
|
||||
+ char name_buf[1];
|
||||
} ws2_accept_async;
|
||||
|
||||
@@ -2065,7 +2066,6 @@ static NTSTATUS WS2_async_accept( void *arg, IO_STATUS_BLOCK *iosb, NTSTATUS sta
|
||||
{
|
||||
struct ws2_accept_async *wsa = arg;
|
||||
int len;
|
||||
- char *addr;
|
||||
|
||||
TRACE("status: 0x%x listen: %p, accept: %p\n", status, wsa->listen_socket, wsa->accept_socket);
|
||||
|
||||
@@ -2095,17 +2095,29 @@ static NTSTATUS WS2_async_accept( void *arg, IO_STATUS_BLOCK *iosb, NTSTATUS sta
|
||||
goto finish;
|
||||
|
||||
/* WS2 Spec says size param is extra 16 bytes long...what do we put in it? */
|
||||
- addr = ((char *)wsa->buf) + wsa->data_len;
|
||||
len = wsa->local_len - sizeof(int);
|
||||
WS_getsockname(HANDLE2SOCKET(wsa->accept_socket),
|
||||
- (struct WS_sockaddr *)(addr + sizeof(int)), &len);
|
||||
- *(int *)addr = len;
|
||||
+ (struct WS_sockaddr *)(wsa->name_buf + sizeof(int)), &len);
|
||||
+ *(int *)wsa->name_buf = len;
|
||||
+
|
||||
+ if (wine_uninterrupted_write_memory( (char *)wsa->buf + wsa->data_len,
|
||||
+ wsa->name_buf, sizeof(int) + len ) < sizeof(int) + len)
|
||||
+ {
|
||||
+ status = STATUS_ACCESS_VIOLATION;
|
||||
+ goto finish;
|
||||
+ }
|
||||
|
||||
- addr += wsa->local_len;
|
||||
len = wsa->remote_len - sizeof(int);
|
||||
WS_getpeername(HANDLE2SOCKET(wsa->accept_socket),
|
||||
- (struct WS_sockaddr *)(addr + sizeof(int)), &len);
|
||||
- *(int *)addr = len;
|
||||
+ (struct WS_sockaddr *)(wsa->name_buf + sizeof(int)), &len);
|
||||
+ *(int *)wsa->name_buf = len;
|
||||
+
|
||||
+ if (wine_uninterrupted_write_memory( (char *)wsa->buf + wsa->data_len + wsa->local_len,
|
||||
+ wsa->name_buf, sizeof(int) + len ) < sizeof(int) + len)
|
||||
+ {
|
||||
+ status = STATUS_ACCESS_VIOLATION;
|
||||
+ goto finish;
|
||||
+ }
|
||||
|
||||
if (!wsa->read)
|
||||
goto finish;
|
||||
@@ -2433,7 +2445,8 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
|
||||
}
|
||||
release_sock_fd( acceptor, fd );
|
||||
|
||||
- wsa = HeapAlloc( GetProcessHeap(), 0, sizeof(*wsa) );
|
||||
+ wsa = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(struct ws2_accept_async,
|
||||
+ name_buf[max( local_addr_len, rem_addr_len )]) );
|
||||
if(!wsa)
|
||||
{
|
||||
SetLastError(WSAEFAULT);
|
||||
--
|
||||
2.2.2
|
||||
|
@ -1 +1,2 @@
|
||||
Fixes: Avoid race-conditions of async WSARecv() operations with write watches.
|
||||
Fixes: Avoid race-conditions with write watches in WS2_async_accept.
|
||||
|
Loading…
x
Reference in New Issue
Block a user