Rémi Bernon : ntdll: Leave some space around DbgBreakPoint and DbgUserBreakPoint.

Alexandre Julliard julliard at winehq.org
Wed Jun 24 15:47:34 CDT 2020


Module: wine
Branch: master
Commit: f5a8ed47a3fb4cdb9066899303f03565001b4cc7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f5a8ed47a3fb4cdb9066899303f03565001b4cc7

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Jun 24 10:03:10 2020 +0200

ntdll: Leave some space around DbgBreakPoint and DbgUserBreakPoint.

CoD: Black Ops 3 and CoD: WWII modify these (and several others) and
expect to have enough space for a few instructions.

It then verifies later that the patches are still in place, and
terminates if the byte sequence do not match. Having small symbols can
make the patches to overlap and the check to fail.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/signal_arm64.c  | 8 ++++++--
 dlls/ntdll/signal_i386.c   | 8 ++++++--
 dlls/ntdll/signal_x86_64.c | 8 ++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 0159888f7a..ddced4e0ba 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -1358,12 +1358,16 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
 /**********************************************************************
  *              DbgBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "brk #0; ret")
+__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "brk #0; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 /**********************************************************************
  *              DbgUserBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "brk #0; ret")
+__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "brk #0; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 /**********************************************************************
  *           NtCurrentTeb   (NTDLL.@)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index bda19bf463..d91d19f043 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -555,12 +555,16 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
 /**********************************************************************
  *		DbgBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "int $3; ret")
+__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "int $3; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 /**********************************************************************
  *		DbgUserBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "int $3; ret")
+__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "int $3; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 /**********************************************************************
  *           NtCurrentTeb   (NTDLL.@)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 52f7b73f8b..284522ffae 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -2751,11 +2751,15 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
 /**********************************************************************
  *		DbgBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "int $3; ret")
+__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "int $3; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 /**********************************************************************
  *		DbgUserBreakPoint   (NTDLL.@)
  */
-__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "int $3; ret")
+__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "int $3; ret"
+                    "\n\tnop; nop; nop; nop; nop; nop; nop; nop"
+                    "\n\tnop; nop; nop; nop; nop; nop" );
 
 #endif  /* __x86_64__ */




More information about the wine-cvs mailing list