diff --git a/patches/ntdll-set_context_reg/0001-ntdll-Do-not-cast-unaligned-pointer-to-M128A-in-set_.patch b/patches/ntdll-set_context_reg/0001-ntdll-Do-not-cast-unaligned-pointer-to-M128A-in-set_.patch new file mode 100644 index 00000000..76de22a3 --- /dev/null +++ b/patches/ntdll-set_context_reg/0001-ntdll-Do-not-cast-unaligned-pointer-to-M128A-in-set_.patch @@ -0,0 +1,71 @@ +From 265879650f33f8c39fb2ed7a1b08cb33f064fcb2 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 4 Jun 2017 16:26:03 +0200 +Subject: ntdll: Do not cast unaligned pointer to M128A in set_context_reg. + +--- + dlls/ntdll/signal_x86_64.c | 48 +++++++++++++++++++++++----------------------- + 1 file changed, 24 insertions(+), 24 deletions(-) + +diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c +index f3f14c998d8..6edf4b9a90d 100644 +--- a/dlls/ntdll/signal_x86_64.c ++++ b/dlls/ntdll/signal_x86_64.c +@@ -1154,30 +1154,30 @@ static void set_context_reg( CONTEXT *context, ULONG_PTR dw_reg, void *val ) + case 14: context->R14 = *(ULONG64 *)val; break; + case 15: context->R15 = *(ULONG64 *)val; break; + case 16: context->Rip = *(ULONG64 *)val; break; +- case 17: context->u.s.Xmm0 = *(M128A *)val; break; +- case 18: context->u.s.Xmm1 = *(M128A *)val; break; +- case 19: context->u.s.Xmm2 = *(M128A *)val; break; +- case 20: context->u.s.Xmm3 = *(M128A *)val; break; +- case 21: context->u.s.Xmm4 = *(M128A *)val; break; +- case 22: context->u.s.Xmm5 = *(M128A *)val; break; +- case 23: context->u.s.Xmm6 = *(M128A *)val; break; +- case 24: context->u.s.Xmm7 = *(M128A *)val; break; +- case 25: context->u.s.Xmm8 = *(M128A *)val; break; +- case 26: context->u.s.Xmm9 = *(M128A *)val; break; +- case 27: context->u.s.Xmm10 = *(M128A *)val; break; +- case 28: context->u.s.Xmm11 = *(M128A *)val; break; +- case 29: context->u.s.Xmm12 = *(M128A *)val; break; +- case 30: context->u.s.Xmm13 = *(M128A *)val; break; +- case 31: context->u.s.Xmm14 = *(M128A *)val; break; +- case 32: context->u.s.Xmm15 = *(M128A *)val; break; +- case 33: context->u.s.Legacy[0] = *(M128A *)val; break; +- case 34: context->u.s.Legacy[1] = *(M128A *)val; break; +- case 35: context->u.s.Legacy[2] = *(M128A *)val; break; +- case 36: context->u.s.Legacy[3] = *(M128A *)val; break; +- case 37: context->u.s.Legacy[4] = *(M128A *)val; break; +- case 38: context->u.s.Legacy[5] = *(M128A *)val; break; +- case 39: context->u.s.Legacy[6] = *(M128A *)val; break; +- case 40: context->u.s.Legacy[7] = *(M128A *)val; break; ++ case 17: memcpy( &context->u.s.Xmm0, val, sizeof(M128A) ); break; ++ case 18: memcpy( &context->u.s.Xmm1, val, sizeof(M128A) ); break; ++ case 19: memcpy( &context->u.s.Xmm2, val, sizeof(M128A) ); break; ++ case 20: memcpy( &context->u.s.Xmm3, val, sizeof(M128A) ); break; ++ case 21: memcpy( &context->u.s.Xmm4, val, sizeof(M128A) ); break; ++ case 22: memcpy( &context->u.s.Xmm5, val, sizeof(M128A) ); break; ++ case 23: memcpy( &context->u.s.Xmm6, val, sizeof(M128A) ); break; ++ case 24: memcpy( &context->u.s.Xmm7, val, sizeof(M128A) ); break; ++ case 25: memcpy( &context->u.s.Xmm8, val, sizeof(M128A) ); break; ++ case 26: memcpy( &context->u.s.Xmm9, val, sizeof(M128A) ); break; ++ case 27: memcpy( &context->u.s.Xmm10, val, sizeof(M128A) ); break; ++ case 28: memcpy( &context->u.s.Xmm11, val, sizeof(M128A) ); break; ++ case 29: memcpy( &context->u.s.Xmm12, val, sizeof(M128A) ); break; ++ case 30: memcpy( &context->u.s.Xmm13, val, sizeof(M128A) ); break; ++ case 31: memcpy( &context->u.s.Xmm14, val, sizeof(M128A) ); break; ++ case 32: memcpy( &context->u.s.Xmm15, val, sizeof(M128A) ); break; ++ case 33: memcpy( &context->u.s.Legacy[0], val, sizeof(M128A) ); break; ++ case 34: memcpy( &context->u.s.Legacy[1], val, sizeof(M128A) ); break; ++ case 35: memcpy( &context->u.s.Legacy[2], val, sizeof(M128A) ); break; ++ case 36: memcpy( &context->u.s.Legacy[3], val, sizeof(M128A) ); break; ++ case 37: memcpy( &context->u.s.Legacy[4], val, sizeof(M128A) ); break; ++ case 38: memcpy( &context->u.s.Legacy[5], val, sizeof(M128A) ); break; ++ case 39: memcpy( &context->u.s.Legacy[6], val, sizeof(M128A) ); break; ++ case 40: memcpy( &context->u.s.Legacy[7], val, sizeof(M128A) ); break; + } + } + +-- +2.13.0 + diff --git a/patches/ntdll-set_context_reg/definition b/patches/ntdll-set_context_reg/definition new file mode 100644 index 00000000..e4ac3eb5 --- /dev/null +++ b/patches/ntdll-set_context_reg/definition @@ -0,0 +1 @@ +Fixes: [43127] Avoid conversion from unaligned pointer to M128A diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 96fa19e0..cd235f37 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -281,6 +281,7 @@ patch_enable_all () enable_ntdll_Zero_mod_name="$1" enable_ntdll__aulldvrm="$1" enable_ntdll_call_thread_func_wrapper="$1" + enable_ntdll_set_context_reg="$1" enable_ntoskrnl_DriverTest="$1" enable_ntoskrnl_Stubs="$1" enable_nvapi_Stub_DLL="$1" @@ -1081,6 +1082,9 @@ patch_enable () ntdll-call_thread_func_wrapper) enable_ntdll_call_thread_func_wrapper="$2" ;; + ntdll-set_context_reg) + enable_ntdll_set_context_reg="$2" + ;; ntoskrnl-DriverTest) enable_ntoskrnl_DriverTest="$2" ;; @@ -6291,6 +6295,21 @@ if test "$enable_ntdll_call_thread_func_wrapper" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-set_context_reg +# | +# | This patchset fixes the following Wine bugs: +# | * [#43127] Avoid conversion from unaligned pointer to M128A +# | +# | Modified files: +# | * dlls/ntdll/signal_x86_64.c +# | +if test "$enable_ntdll_set_context_reg" -eq 1; then + patch_apply ntdll-set_context_reg/0001-ntdll-Do-not-cast-unaligned-pointer-to-M128A-in-set_.patch + ( + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Do not cast unaligned pointer to M128A in set_context_reg.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntoskrnl-DriverTest # | # | Modified files: