From 28d60dbd10fff61dc1b4b87e37761020cc9bab16 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 3 Oct 2015 18:30:52 +0200 Subject: [PATCH] Added patch to fix random crashes of Cygwin/MSYS2 for some compilers. --- debian/changelog | 1 + ...01-ntdll-Initialize-mod_name-to-zero.patch | 25 +++++++++++++++++++ patches/ntdll-Zero_mod_name/definition | 1 + patches/patchinstall.sh | 16 ++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 patches/ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch create mode 100644 patches/ntdll-Zero_mod_name/definition diff --git a/debian/changelog b/debian/changelog index 2ac3366b..02064d98 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,6 +29,7 @@ wine-staging (1.7.52) UNRELEASED; urgency=low * Added patch to make ddraw1 and ddraw_surface1 vtable as writable. * Added patch for implementation of mfplat.MFTEnum. * Added patch to implement ws2_32.InetPtonA/W functions. + * Added patch to fix random crashes of Cygwin/MSYS2 for some compilers. * Removed patch to fix possible memory leak in netprofm init_networks (fixed upstream). * Removed patch for stub of dwmapi.DwmUpdateThumbnailProperties (accepted diff --git a/patches/ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch b/patches/ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch new file mode 100644 index 00000000..46655706 --- /dev/null +++ b/patches/ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch @@ -0,0 +1,25 @@ +From 5eeaec794d902cffb4b7911878d5913ef0a38b93 Mon Sep 17 00:00:00 2001 +From: Qian Hong +Date: Wed, 9 Sep 2015 05:31:18 +0800 +Subject: ntdll: Initialize mod_name to zero. + +--- + dlls/ntdll/loader.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c +index 831f049..ae89819 100644 +--- a/dlls/ntdll/loader.c ++++ b/dlls/ntdll/loader.c +@@ -1087,6 +1087,8 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved + if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.BaseAddress, reason ); + if (!entry || !(wm->ldr.Flags & LDR_IMAGE_IS_DLL)) return STATUS_SUCCESS; + ++ memset( mod_name, 0, sizeof(mod_name) ); ++ + if (TRACE_ON(relay)) + { + size_t len = min( wm->ldr.BaseDllName.Length, sizeof(mod_name)-sizeof(WCHAR) ); +-- +2.5.1 + diff --git a/patches/ntdll-Zero_mod_name/definition b/patches/ntdll-Zero_mod_name/definition new file mode 100644 index 00000000..c84b4bd2 --- /dev/null +++ b/patches/ntdll-Zero_mod_name/definition @@ -0,0 +1 @@ +#Fixes: Fixes random crashes of Cygwin/MSYS2 for some compilers diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 900d2ce7..1485f217 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -218,6 +218,7 @@ patch_enable_all () enable_ntdll_WRITECOPY="$1" enable_ntdll_WinSqm="$1" enable_ntdll_WriteWatches="$1" + enable_ntdll_Zero_mod_name="$1" enable_ntoskrnl_DriverTest="$1" enable_ntoskrnl_Stubs="$1" enable_nvapi_Stub_DLL="$1" @@ -757,6 +758,9 @@ patch_enable () ntdll-WriteWatches) enable_ntdll_WriteWatches="$2" ;; + ntdll-Zero_mod_name) + enable_ntdll_Zero_mod_name="$2" + ;; ntoskrnl-DriverTest) enable_ntoskrnl_DriverTest="$2" ;; @@ -4443,6 +4447,18 @@ if test "$enable_ntdll_WriteWatches" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-Zero_mod_name +# | +# | Modified files: +# | * dlls/ntdll/loader.c +# | +if test "$enable_ntdll_Zero_mod_name" -eq 1; then + patch_apply ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch + ( + echo '+ { "Qian Hong", "ntdll: Initialize mod_name to zero.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntoskrnl-DriverTest # | # | Modified files: