diff --git a/README.md b/README.md index c10425a3..dd292049 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ Wine. All those differences are also documented on the Included bug fixes and improvements =================================== +**Bugfixes and features included in the next upcoming release [1]:** + +* Avoid race-conditions in NtReadFile() operations with write watches. + + **Bugs fixed in Wine Staging 1.7.36 [167]:** * Add Dynamic DST exceptions for Israel Standard Time ([Wine Bug #36374](https://bugs.winehq.org/show_bug.cgi?id=36374)) diff --git a/debian/changelog b/debian/changelog index 4b8fe2f5..86d3d60a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,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. * Removed patches for UTF7 support (accepted upstream). -- Sebastian Lackner Sun, 08 Feb 2015 20:29:38 +0100 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 new file mode 100644 index 00000000..2c623364 --- /dev/null +++ b/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch @@ -0,0 +1,36 @@ +From 36c5307ddaea9ee5f0b1709ed14f3ec4b580acae 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/ntdll/file.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c +index e564bdd..10e17d8 100644 +--- a/dlls/ntdll/file.c ++++ b/dlls/ntdll/file.c +@@ -541,6 +541,8 @@ static NTSTATUS read_unix_fd(int fd, char *buf, ULONG *total, ULONG length, + else + return STATUS_PENDING; + } ++ else if (errno == EFAULT && wine_uninterrupted_write_memory( buf + *total, NULL, length - *total ) >= (length - *total)) ++ continue; + else if (errno != EINTR) + return FILE_GetNtStatus(); + } +@@ -780,6 +782,9 @@ 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 != EINTR) + { + status = FILE_GetNtStatus(); +-- +2.2.2 + diff --git a/patches/ntdll-WriteWatches/definition b/patches/ntdll-WriteWatches/definition new file mode 100644 index 00000000..28425d72 --- /dev/null +++ b/patches/ntdll-WriteWatches/definition @@ -0,0 +1,3 @@ +Fixes: Avoid race-conditions in NtReadFile() operations with write watches. +Depends: ws2_32-WriteWatches +Depends: kernel32-Named_Pipe diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 57fa17ab..8b74593f 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -135,6 +135,7 @@ patch_enable_all () enable_ntdll_Vista_Threadpool="$1" enable_ntdll_WRITECOPY="$1" enable_ntdll_WinSqm="$1" + enable_ntdll_WriteWatches="$1" enable_ntoskrnl_DriverTest="$1" enable_ntoskrnl_Emulator="$1" enable_ntoskrnl_Stubs="$1" @@ -432,6 +433,9 @@ patch_enable () ntdll-WinSqm) enable_ntdll_WinSqm="$2" ;; + ntdll-WriteWatches) + enable_ntdll_WriteWatches="$2" + ;; ntoskrnl-DriverTest) enable_ntoskrnl_DriverTest="$2" ;; @@ -942,6 +946,17 @@ if test "$enable_ntoskrnl_Emulator" -eq 1; then enable_ntdll_User_Shared_Data=1 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 + if test "$enable_ntdll_Junction_Points" -eq 1; then if test "$enable_ntdll_Fix_Free" -gt 1; then abort "Patchset ntdll-Fix_Free disabled, but ntdll-Junction_Points depends on that." @@ -2288,6 +2303,18 @@ if test "$enable_ntdll_WinSqm" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-WriteWatches +# | +# | Modified files: +# | * dlls/ntdll/file.c +# | +if test "$enable_ntdll_WriteWatches" -eq 1; then + patch_apply ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch + ( + echo '+ { "Dmitry Timoshkov", "ntdll: Avoid race-conditions with write watches in NtReadFile.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntoskrnl-DriverTest # | # | Modified files: