Removed multiple patches (accepted upstream).

This commit is contained in:
Sebastian Lackner 2015-02-27 15:34:05 +01:00
parent e01d563654
commit 2de8f84fb0
9 changed files with 15 additions and 349 deletions

View File

@ -88,7 +88,7 @@ Included bug fixes and improvements
* Child of Light expects FindConnectionPoint to succeed and increase the refcount ([Wine Bug #36408](https://bugs.winehq.org/show_bug.cgi?id=36408))
* CreateProcess does not prioritize the working directory over the system search path ([Wine Bug #23934](https://bugs.winehq.org/show_bug.cgi?id=23934))
* D3DCompileShader should filter specific warning messages ([Wine Bug #33770](https://bugs.winehq.org/show_bug.cgi?id=33770))
* Do not access stack below ESP when restoring thread context.
* ~~Do not access stack below ESP when restoring thread context.~~
* Do not append duplicate NULL characters when importing keys with regedit ([Wine Bug #37575](https://bugs.winehq.org/show_bug.cgi?id=37575))
* Do not fail when a used context is passed to wglShareLists ([Wine Bug #11436](https://bugs.winehq.org/show_bug.cgi?id=11436))
* Emulate access to KI_USER_SHARED_DATA kernel page on x86_64 ([Wine Bug #33849](https://bugs.winehq.org/show_bug.cgi?id=33849))
@ -119,7 +119,7 @@ Included bug fixes and improvements
* Fix init of LONGLONG variable with a negative value in TGA decoder
* Fix issues with dragging layers between images in Adobe Photoshop 7.0 ([Wine Bug #12007](https://bugs.winehq.org/show_bug.cgi?id=12007))
* Fix missing video introduced by pixelformat changes. ([Wine Bug #36900](https://bugs.winehq.org/show_bug.cgi?id=36900))
* Fix mouse jittering in Planetside 2 ([Wine Bug #32913](https://bugs.winehq.org/show_bug.cgi?id=32913))
* ~~Fix mouse jittering in Planetside 2~~ ([Wine Bug #32913](https://bugs.winehq.org/show_bug.cgi?id=32913))
* Fix parameters for ConvertToIndexedBlendedMesh stub ([Wine Bug #36449](https://bugs.winehq.org/show_bug.cgi?id=36449))
* Fix possible segfault in pulse_rd_loop of PulseAudio backend
* Fix return value of ScrollWindowEx for invisible windows ([Wine Bug #37706](https://bugs.winehq.org/show_bug.cgi?id=37706))

3
debian/changelog vendored
View File

@ -21,6 +21,9 @@ wine-staging (1.7.38) UNRELEASED; urgency=low
* Removed patch to fix arguments for OSMesaMakeCurrent when using 16 bit formats (accepted upstream).
* Removed patch to fix memory leak in ApplicationAssociationRegistration_QueryCurrentDefault (accepted upstream).
* Removed patch to complete and properly pack DNS_HEADER structure (accepted upstream).
* Removed patch to avoid accessing stack below ESP when restoring thread context (accepted upstream).
* Removed patch to fix mouse jittering in Planetside 2 (accepted upstream).
* Removed patch to handle write watches while we're on the signal stack (accepted upstream).
-- Sebastian Lackner <sebastian@fds-team.de> Mon, 23 Feb 2015 18:24:51 +0100
wine-staging (1.7.37) unstable; urgency=low

View File

@ -190,7 +190,6 @@ patch_enable_all ()
enable_wine_inf_Performance="$1"
enable_wineboot_HKEY_DYN_DATA="$1"
enable_winebuild_LinkerVersion="$1"
enable_winebuild_Restore_Context="$1"
enable_winecfg_Libraries="$1"
enable_winecfg_Staging="$1"
enable_wined3d_CSMT_Helper="$1"
@ -202,7 +201,6 @@ patch_enable_all ()
enable_winepulse_PulseAudio_Support="$1"
enable_winex11_CandidateWindowPos="$1"
enable_winex11_Clipboard_HTML="$1"
enable_winex11_RawEventWarp="$1"
enable_winex11_Window_Groups="$1"
enable_winex11_Window_Style="$1"
enable_winex11_XEMBED="$1"
@ -604,9 +602,6 @@ patch_enable ()
winebuild-LinkerVersion)
enable_winebuild_LinkerVersion="$2"
;;
winebuild-Restore_Context)
enable_winebuild_Restore_Context="$2"
;;
winecfg-Libraries)
enable_winecfg_Libraries="$2"
;;
@ -640,9 +635,6 @@ patch_enable ()
winex11-Clipboard_HTML)
enable_winex11_Clipboard_HTML="$2"
;;
winex11-RawEventWarp)
enable_winex11_RawEventWarp="$2"
;;
winex11-Window_Groups)
enable_winex11_Window_Groups="$2"
;;
@ -1074,22 +1066,19 @@ fi
# Patchset ws2_32-WriteWatches
# |
# | Modified files:
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/signal_arm.c, dlls/ntdll/signal_arm64.c,
# | dlls/ntdll/signal_i386.c, dlls/ntdll/signal_powerpc.c, dlls/ntdll/signal_x86_64.c, dlls/ntdll/virtual.c,
# | dlls/ws2_32/socket.c, include/winternl.h
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/signal_i386.c, dlls/ntdll/virtual.c, dlls/ws2_32/socket.c,
# | include/winternl.h
# |
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
patch_apply ws2_32-WriteWatches/0005-ntdll-Try-to-handle-write-watches-while-we-re-on-the.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 },';
echo '+ { "Sebastian Lackner", "ntdll: Try to handle write-watches while we'\''re on the signal stack.", 2 },';
) >> "$patchlist"
fi
@ -3795,18 +3784,6 @@ if test "$enable_winebuild_LinkerVersion" -eq 1; then
) >> "$patchlist"
fi
# Patchset winebuild-Restore_Context
# |
# | Modified files:
# | * tools/winebuild/relay.c
# |
if test "$enable_winebuild_Restore_Context" -eq 1; then
patch_apply winebuild-Restore_Context/0001-winebuild-Do-not-access-memory-below-ESP-when-restor.patch
(
echo '+ { "Sebastian Lackner", "winebuild: Do not access memory below ESP when restoring thread contexts.", 1 },';
) >> "$patchlist"
fi
# Patchset winecfg-Libraries
# |
# | This patchset fixes the following Wine bugs:
@ -3971,21 +3948,6 @@ if test "$enable_winex11_Clipboard_HTML" -eq 1; then
) >> "$patchlist"
fi
# Patchset winex11-RawEventWarp
# |
# | This patchset fixes the following Wine bugs:
# | * [#32913] Fix mouse jittering in Planetside 2
# |
# | Modified files:
# | * dlls/winex11.drv/mouse.c
# |
if test "$enable_winex11_RawEventWarp" -eq 1; then
patch_apply winex11-RawEventWarp/0001-winex11-Only-enable-XInput2-cursor-warp-workaround-i.patch
(
echo '+ { "Sebastian Lackner", "winex11: Only enable XInput2 cursor warp workaround if necessary.", 1 },';
) >> "$patchlist"
fi
# Patchset winex11-Window_Groups
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,83 +0,0 @@
From 2c9e4af027218dd83ee68bed4ff5ab277ce8948a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 12 Feb 2015 11:09:34 +0100
Subject: winebuild: Do not access memory below ESP when restoring thread
contexts.
Based on a patch by John Reiser.
---
tools/winebuild/relay.c | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index cc7dd37..aa7158e 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -852,31 +852,48 @@ static void build_call_from_regs_x86(void)
/* Restore the context structure */
- output( "2:\tpushl 0x94(%%ecx)\n"); /* SegEs */
+ output( "2:\n" );
+
+ /* As soon as we have switched stacks the context structure could
+ * be invalid (when signal handlers are executed for example). Copy
+ * values on the target stack before changing ESP. */
+
+ output( "\tpushl 0xc8(%%ecx)\n" ); /* SegSs */
+ output( "\tpopl %%es\n" );
+ output( "\tmovl 0xc4(%%ecx),%%eax\n" ); /* Esp */
+ output( "\tsubl $4*4, %%eax\n" );
+
+ output( "\tmovl 0xc0(%%ecx),%%edx\n" ); /* EFlags */
+ output( "\t.byte 0x26\n\tmovl %%edx,3*4(%%eax)\n" );
+ output( "\tmovl 0xbc(%%ecx),%%edx\n" ); /* SegCs */
+ output( "\t.byte 0x26\n\tmovl %%edx,2*4(%%eax)\n" );
+ output( "\tmovl 0xb8(%%ecx),%%edx\n" ); /* Eip */
+ output( "\t.byte 0x26\n\tmovl %%edx,1*4(%%eax)\n" );
+ output( "\tmovl 0xb0(%%ecx),%%edx\n" ); /* Eax */
+ output( "\t.byte 0x26\n\tmovl %%edx,0*4(%%eax)\n" );
+
+ output( "\tpushl %%es\n" );
+ output( "\tpushl 0x98(%%ecx)\n" ); /* SegDs */
+
+ output(" \tpushl 0x94(%%ecx)\n" ); /* SegEs */
output( "\tpopl %%es\n" );
output( "\tpushl 0x90(%%ecx)\n"); /* SegFs */
output( "\tpopl %%fs\n" );
output( "\tpushl 0x8c(%%ecx)\n"); /* SegGs */
output( "\tpopl %%gs\n" );
- output( "\tmovl 0x9c(%%ecx),%%edi\n"); /* Edi */
- output( "\tmovl 0xa0(%%ecx),%%esi\n"); /* Esi */
- output( "\tmovl 0xa8(%%ecx),%%edx\n"); /* Edx */
- output( "\tmovl 0xa4(%%ecx),%%ebx\n"); /* Ebx */
- output( "\tmovl 0xb0(%%ecx),%%eax\n"); /* Eax */
- output( "\tmovl 0xb4(%%ecx),%%ebp\n"); /* Ebp */
+ output( "\tmovl 0x9c(%%ecx),%%edi\n" ); /* Edi */
+ output( "\tmovl 0xa0(%%ecx),%%esi\n" ); /* Esi */
+ output( "\tmovl 0xa4(%%ecx),%%ebx\n" ); /* Ebx */
+ output( "\tmovl 0xa8(%%ecx),%%edx\n" ); /* Edx */
+ output( "\tmovl 0xb4(%%ecx),%%ebp\n" ); /* Ebp */
+ output( "\tmovl 0xac(%%ecx),%%ecx\n" ); /* Ecx */
- output( "\tpushl 0xc8(%%ecx)\n"); /* SegSs */
+ output( "\tpopl %%ds\n" );
output( "\tpopl %%ss\n" );
- output( "\tmovl 0xc4(%%ecx),%%esp\n"); /* Esp */
+ output( "\tmovl %%eax,%%esp\n" );
- output( "\tpushl 0xc0(%%ecx)\n"); /* EFlags */
- output( "\tpushl 0xbc(%%ecx)\n"); /* SegCs */
- output( "\tpushl 0xb8(%%ecx)\n"); /* Eip */
- output( "\tpushl 0x98(%%ecx)\n"); /* SegDs */
- output( "\tmovl 0xac(%%ecx),%%ecx\n"); /* Ecx */
-
- output( "\tpopl %%ds\n" );
+ output( "\tpopl %%eax\n" );
output( "\tiret\n" );
output_cfi( ".cfi_endproc" );
output_function_size( "__wine_call_from_regs" );
--
2.2.2

View File

@ -1 +0,0 @@
Fixes: Do not access stack below ESP when restoring thread context.

View File

@ -1,64 +0,0 @@
From 88a383d2386e770e433b8c14d7a94b2511171695 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 26 Jan 2015 05:42:32 +0100
Subject: winex11: Only enable XInput2 cursor warp workaround if necessary.
Based on a patch by Patrick Rudolph.
---
dlls/winex11.drv/mouse.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f1e58fe..5f5bdeb 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -131,6 +131,7 @@ static Cursor create_cursor( HANDLE handle );
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
static BOOL xinput2_available;
+static BOOL broken_rawevents;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
MAKE_FUNCPTR(XIFreeDeviceInfo);
MAKE_FUNCPTR(XIQueryDevice);
@@ -1579,7 +1580,15 @@ void X11DRV_MotionNotify( HWND hwnd, XEvent *xev )
if (!hwnd)
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
- if (thread_data->warp_serial && (long)(event->serial - thread_data->warp_serial) < 0) return;
+ if (thread_data->warp_serial)
+ {
+ if ((long)(event->serial - thread_data->warp_serial) < 0)
+ {
+ TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, event->serial );
+ return;
+ }
+ thread_data->warp_serial = 0; /* we caught up now */
+ }
}
send_mouse_input( hwnd, event->window, event->state, &input );
@@ -1669,7 +1678,7 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev )
break;
}
- if (thread_data->warp_serial)
+ if (broken_rawevents && thread_data->warp_serial)
{
if ((long)(xev->serial - thread_data->warp_serial) < 0)
{
@@ -1716,6 +1725,12 @@ void X11DRV_XInput2_Init(void)
#undef LOAD_FUNCPTR
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
+
+ /* Until version 1.10.4 rawinput was broken in XOrg, see
+ * https://bugs.freedesktop.org/show_bug.cgi?id=30068 */
+ broken_rawevents = strstr(XServerVendor( gdi_display ), "X.Org") &&
+ XVendorRelease( gdi_display ) < 11004000;
+
#else
TRACE( "X Input 2 support not compiled in.\n" );
#endif
--
2.2.1

View File

@ -1 +0,0 @@
Fixes: [32913] Fix mouse jittering in Planetside 2

View File

@ -1,4 +1,4 @@
From 32e36972905ea820ac557c37b6d3a02dd32fd795 Mon Sep 17 00:00:00 2001
From c81fa97c5fc573dd3bc40dcee861ad7c70abc4d9 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 3 Jan 2015 20:07:08 +0100
Subject: ntdll: Expose wine_uninterrupted_[read|write]_memory as exports.
@ -12,7 +12,7 @@ Subject: ntdll: Expose wine_uninterrupted_[read|write]_memory as exports.
5 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 51de6e7..1e91089 100644
index 9355d04..c13a555 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1430,6 +1430,10 @@
@ -27,11 +27,11 @@ index 51de6e7..1e91089 100644
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
@ cdecl wine_unix_to_nt_file_name(ptr ptr)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index b7ea6dc..e56e78b 100644
index 674fcbc..79eea52 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -171,8 +171,6 @@ extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLS
extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err ) DECLSPEC_HIDDEN;
@@ -172,8 +172,6 @@ extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLS
extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
-extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
@ -40,7 +40,7 @@ index b7ea6dc..e56e78b 100644
extern void virtual_release_address_space(void) DECLSPEC_HIDDEN;
extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 1a69bc0..de55c31 100644
index 5c3aa819..cf20483 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -1669,13 +1669,13 @@ static BOOL check_atl_thunk( EXCEPTION_RECORD *rec, CONTEXT *context )
@ -75,7 +75,7 @@ index 1a69bc0..de55c31 100644
{
context->Ecx = stack[0];
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 8823164..17792e1 100644
index e5bf705..4392c3e 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1672,13 +1672,14 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
@ -165,5 +165,5 @@ index 1a694da..02dda9a 100644
/***********************************************************************
* Inline functions
--
2.2.1
2.3.0

View File

@ -1,150 +0,0 @@
From d20c4092f475898e7f5236bceb4604bb8c76ab09 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 10 Feb 2015 14:54:25 +0100
Subject: ntdll: Try to handle write-watches while we're on the signal stack.
(try 2)
Yes, this patch is really necessary. DotNet somehow thinks its a good idea
to store the IO status block in a write-watch protected memory area. If we
do not want to add wine_uninterrupted_write_memory _EVERYWHERE_ in the wine
code, we unfortunately really have to implement exception handling on the
signal stack. This is just a very basic hacky implementation of write-watch
handling, all other kind of exceptions are not handled properly yet.
---
dlls/ntdll/ntdll_misc.h | 2 +-
dlls/ntdll/signal_arm.c | 2 +-
dlls/ntdll/signal_arm64.c | 2 +-
dlls/ntdll/signal_i386.c | 11 ++++++++++-
dlls/ntdll/signal_powerpc.c | 4 ++--
dlls/ntdll/signal_x86_64.c | 2 +-
dlls/ntdll/virtual.c | 4 ++--
7 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index afd1980..79eea52 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -169,7 +169,7 @@ extern NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_
extern void virtual_clear_thread_stack(void) DECLSPEC_HIDDEN;
extern BOOL virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
-extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err ) DECLSPEC_HIDDEN;
+extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern void VIRTUAL_SetForceExec( BOOL enable ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c
index e3ae7bd..53a2663 100644
--- a/dlls/ntdll/signal_arm.c
+++ b/dlls/ntdll/signal_arm.c
@@ -443,7 +443,7 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context
if (rec->NumberParameters == 2)
{
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
- rec->ExceptionInformation[0] )))
+ rec->ExceptionInformation[0], FALSE )))
goto done;
}
break;
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 8c8f7af..ccbdf4c 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -326,7 +326,7 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context
if (rec->NumberParameters == 2)
{
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
- rec->ExceptionInformation[0] )))
+ rec->ExceptionInformation[0], FALSE )))
goto done;
}
break;
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index de55c31..cf20483 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -1907,7 +1907,7 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context
if (rec->ExceptionInformation[1] == 0xffffffff && check_invalid_gs( context ))
goto done;
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
- rec->ExceptionInformation[0] )))
+ rec->ExceptionInformation[0], FALSE )))
goto done;
if (rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&
rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT)
@@ -2046,6 +2046,15 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
ucontext_t *context = sigcontext;
void *stack = init_handler( sigcontext, &fs, &gs );
+ /* check for exceptions on the signal stack caused by write watches */
+ if (get_trap_code(context) == TRAP_x86_PAGEFLT &&
+ (char *)stack >= (char *)get_signal_stack() &&
+ (char *)stack < (char *)get_signal_stack() + signal_stack_size &&
+ !virtual_handle_fault( siginfo->si_addr, (get_error_code(context) >> 1) & 0x09, TRUE ))
+ {
+ return;
+ }
+
/* check for page fault inside the thread stack */
if (get_trap_code(context) == TRAP_x86_PAGEFLT &&
(char *)siginfo->si_addr >= (char *)NtCurrentTeb()->DeallocationStack &&
diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c
index 0fca342..886da86 100644
--- a/dlls/ntdll/signal_powerpc.c
+++ b/dlls/ntdll/signal_powerpc.c
@@ -678,7 +678,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec.NumberParameters = 2;
rec.ExceptionInformation[0] = 0; /* FIXME ? */
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
- if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0])))
+ if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
goto done;
break;
default:
@@ -701,7 +701,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec.NumberParameters = 2;
rec.ExceptionInformation[0] = 0; /* FIXME ? */
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
- if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0])))
+ if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
goto done;
break;
#endif
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index c71069d..551687f 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -2286,7 +2286,7 @@ static void raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
if (rec->NumberParameters == 2)
{
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
- rec->ExceptionInformation[0] )))
+ rec->ExceptionInformation[0], FALSE )))
set_cpu_context( context );
}
break;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 36b7662..4392c3e 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1521,7 +1521,7 @@ void virtual_clear_thread_stack(void)
/***********************************************************************
* virtual_handle_fault
*/
-NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err )
+NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
{
struct file_view *view;
NTSTATUS ret = STATUS_ACCESS_VIOLATION;
@@ -1542,7 +1542,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err )
/* ignore fault if page is writable now */
if (VIRTUAL_GetUnixProt( *vprot ) & PROT_WRITE) ret = STATUS_SUCCESS;
}
- if (*vprot & VPROT_GUARD)
+ if (!on_signal_stack && (*vprot & VPROT_GUARD))
{
VIRTUAL_SetProt( view, page, page_size, *vprot & ~VPROT_GUARD );
ret = STATUS_GUARD_PAGE_VIOLATION;
--
2.2.2