diff --git a/patches/ntdll-ForceBottomUpAlloc/definition b/patches/ntdll-ForceBottomUpAlloc/definition index db90605f..646add00 100644 --- a/patches/ntdll-ForceBottomUpAlloc/definition +++ b/patches/ntdll-ForceBottomUpAlloc/definition @@ -1,3 +1,2 @@ Fixes: [48175] AION (64 bit) - crashes in crysystem.dll.CryFree() due to high memory pointers allocated Fixes: [46568] 64-bit msxml6.dll from Microsoft Core XML Services 6.0 redist package fails to load (Wine doesn't respect 44-bit user-mode VA limitation from Windows < 8.1) -Disabled: True diff --git a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch index 1dea43fb..d6a19adf 100644 --- a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch +++ b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch @@ -1,4 +1,4 @@ -From 4785271b7201cd43778befdf15029f858d2d25e9 Mon Sep 17 00:00:00 2001 +From c16f89f347e49c107a46dda6d3b9bb811ccceb47 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 24 Apr 2020 14:55:14 -0500 Subject: [PATCH] ntdll: Track if a WRITECOPY page has been modified. @@ -12,7 +12,7 @@ Signed-off-by: Andrew Wesie 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index bf77d534049..c3c8f2d1d5b 100644 +index d727ff341df..d39f73c8d85 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -125,6 +125,7 @@ struct file_view @@ -22,8 +22,8 @@ index bf77d534049..c3c8f2d1d5b 100644 +#define VPROT_WRITTEN 0x80 /* per-mapping protection flags */ #define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */ - -@@ -1115,7 +1116,7 @@ static int get_unix_prot( BYTE vprot ) + #define VPROT_NATIVE 0x0400 +@@ -1120,7 +1121,7 @@ static int get_unix_prot( BYTE vprot ) #if defined(__i386__) if (vprot & VPROT_WRITECOPY) { @@ -32,7 +32,7 @@ index bf77d534049..c3c8f2d1d5b 100644 prot = (prot & ~PROT_WRITE) | PROT_READ; else prot |= PROT_WRITE | PROT_READ; -@@ -1677,7 +1678,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz +@@ -1557,7 +1558,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz */ static DWORD get_win32_prot( BYTE vprot, unsigned int map_prot ) { @@ -45,7 +45,7 @@ index bf77d534049..c3c8f2d1d5b 100644 if (vprot & VPROT_GUARD) ret |= PAGE_GUARD; if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE; return ret; -@@ -1788,12 +1793,21 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr +@@ -1668,12 +1673,21 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr if (view->protect & VPROT_WRITEWATCH) { /* each page may need different protections depending on write watch flag */ @@ -69,7 +69,7 @@ index bf77d534049..c3c8f2d1d5b 100644 return TRUE; } -@@ -3365,7 +3379,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) +@@ -3433,7 +3447,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) } if (vprot & VPROT_WRITECOPY) { diff --git a/patches/ntdll-WRITECOPY/definition b/patches/ntdll-WRITECOPY/definition index 1bb1113b..9f26ca0c 100644 --- a/patches/ntdll-WRITECOPY/definition +++ b/patches/ntdll-WRITECOPY/definition @@ -1,5 +1,5 @@ Fixes: [29384] Multiple applications expect correct handling of WRITECOPY memory protection (Voobly fails to launch Age of Empires II, MSYS2) -#Depends: ntdll-ForceBottomUpAlloc +Depends: ntdll-ForceBottomUpAlloc # Causes regressions? # https://bugs.wine-staging.com/show_bug.cgi?id=207 # https://bugs.wine-staging.com/show_bug.cgi?id=521 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b5e67260..4d3452a8 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -142,6 +142,7 @@ patch_enable_all () enable_ntdll_DOS_Attributes="$1" enable_ntdll_Exception="$1" enable_ntdll_FileFsFullSizeInformation="$1" + enable_ntdll_ForceBottomUpAlloc="$1" enable_ntdll_HashLinks="$1" enable_ntdll_Hide_Wine_Exports="$1" enable_ntdll_Junction_Points="$1" @@ -453,6 +454,9 @@ patch_enable () ntdll-FileFsFullSizeInformation) enable_ntdll_FileFsFullSizeInformation="$2" ;; + ntdll-ForceBottomUpAlloc) + enable_ntdll_ForceBottomUpAlloc="$2" + ;; ntdll-HashLinks) enable_ntdll_HashLinks="$2" ;; @@ -1288,6 +1292,13 @@ if test "$enable_ntdll_Builtin_Prot" -eq 1; then enable_ntdll_WRITECOPY=1 fi +if test "$enable_ntdll_WRITECOPY" -eq 1; then + if test "$enable_ntdll_ForceBottomUpAlloc" -gt 1; then + abort "Patchset ntdll-ForceBottomUpAlloc disabled, but ntdll-WRITECOPY depends on that." + fi + enable_ntdll_ForceBottomUpAlloc=1 +fi + if test "$enable_fltmgr_sys_FltBuildDefaultSecurityDescriptor" -eq 1; then if test "$enable_winedevice_Default_Drivers" -gt 1; then abort "Patchset winedevice-Default_Drivers disabled, but fltmgr.sys-FltBuildDefaultSecurityDescriptor depends on that." @@ -2326,8 +2337,28 @@ if test "$enable_ntdll_ApiSetMap" -eq 1; then patch_apply ntdll-ApiSetMap/0001-ntdll-Add-dummy-apiset-to-PEB.patch fi +# Patchset ntdll-ForceBottomUpAlloc +# | +# | This patchset fixes the following Wine bugs: +# | * [#48175] AION (64 bit) - crashes in crysystem.dll.CryFree() due to high memory pointers allocated +# | * [#46568] 64-bit msxml6.dll from Microsoft Core XML Services 6.0 redist package fails to load (Wine doesn't respect +# | 44-bit user-mode VA limitation from Windows < 8.1) +# | +# | Modified files: +# | * dlls/ntdll/unix/virtual.c +# | +if test "$enable_ntdll_ForceBottomUpAlloc" -eq 1; then + patch_apply ntdll-ForceBottomUpAlloc/0001-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch + patch_apply ntdll-ForceBottomUpAlloc/0002-ntdll-Increase-free-ranges-view-block-size-on-64-bit.patch + patch_apply ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch + patch_apply ntdll-ForceBottomUpAlloc/0004-ntdll-Exclude-natively-mapped-areas-from-free-areas-.patch +fi + # Patchset ntdll-WRITECOPY # | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-ForceBottomUpAlloc +# | # | This patchset fixes the following Wine bugs: # | * [#29384] Multiple applications expect correct handling of WRITECOPY memory protection (Voobly fails to launch Age of # | Empires II, MSYS2) @@ -2351,7 +2382,7 @@ fi # Patchset ntdll-Builtin_Prot # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-WRITECOPY +# | * ntdll-ForceBottomUpAlloc, ntdll-WRITECOPY # | # | This patchset fixes the following Wine bugs: # | * [#44650] Fix holes in ELF mappings