You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against d003ed3b1743985282c8c8e9c597d77c4b47bb15.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From d587367c1f1e2dbe9b284b32027db068691838eb Mon Sep 17 00:00:00 2001
|
||||
From c6dc4f67d20bd4deb3c8655da9dae191af34135a Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 10 Feb 2015 06:36:52 +0100
|
||||
Subject: ntdll: Avoid race-conditions with write watches in NtReadFile.
|
||||
@@ -10,10 +10,10 @@ Rebased against kernel32-NamedPipe patchset by Sebastian Lackner <sebastian@fds-
|
||||
2 files changed, 22 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 40de97ada2..4765cd6c58 100644
|
||||
index 7366ef17384..6ad887fc34b 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -1722,16 +1722,16 @@ static void test_write_watch(void)
|
||||
@@ -1750,16 +1750,16 @@ static void test_write_watch(void)
|
||||
|
||||
num_bytes = 0;
|
||||
success = GetOverlappedResult( readpipe, &overlapped, &num_bytes, TRUE );
|
||||
@@ -35,21 +35,21 @@ index 40de97ada2..4765cd6c58 100644
|
||||
CloseHandle( readpipe );
|
||||
CloseHandle( writepipe );
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index c153e7bb5c..34fd08fb0b 100644
|
||||
index 0381e558ff6..a4da492573c 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -514,6 +514,10 @@ static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb,
|
||||
@@ -524,6 +524,10 @@ static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb, NTSTAT
|
||||
{
|
||||
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)) ?
|
||||
+ fileio->count - fileio->already ) == STATUS_SUCCESS) ?
|
||||
+ STATUS_PENDING : STATUS_ACCESS_VIOLATION;
|
||||
else /* check to see if the transfer is complete */
|
||||
status = FILE_GetNtStatus();
|
||||
}
|
||||
@@ -875,6 +879,13 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||
@@ -871,6 +875,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)
|
||||
{
|
||||
@@ -63,13 +63,13 @@ index c153e7bb5c..34fd08fb0b 100644
|
||||
if (errno != EINTR)
|
||||
{
|
||||
status = FILE_GetNtStatus();
|
||||
@@ -949,6 +960,13 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||
@@ -945,6 +956,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))
|
||||
+ if (wine_uninterrupted_write_memory( (char *)buffer + total, NULL, length - total ) == STATUS_SUCCESS)
|
||||
+ continue;
|
||||
+ else
|
||||
+ errno = EFAULT;
|
||||
@@ -78,5 +78,5 @@ index c153e7bb5c..34fd08fb0b 100644
|
||||
goto done;
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
2.14.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user