diff --git a/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Stop-search-on-mmap-error-in-try_map_free_area.patch b/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Stop-search-on-mmap-error-in-try_map_free_area.patch new file mode 100644 index 00000000..0a5771ef --- /dev/null +++ b/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Stop-search-on-mmap-error-in-try_map_free_area.patch @@ -0,0 +1,36 @@ +From d326b5e1f14765fed43f674f3693bb881c9e2c55 Mon Sep 17 00:00:00 2001 +From: Paul Gofman +Date: Thu, 9 Jan 2020 15:05:09 +0300 +Subject: [PATCH] ntdll: Stop search on mmap() error in try_map_free_area(). + +The anon mmap errors do not depend on start address hint. Ignoring them +makes the search take incredible time until it fails. +--- + dlls/ntdll/virtual.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c +index 8b515fcbce..e74179b711 100644 +--- a/dlls/ntdll/virtual.c ++++ b/dlls/ntdll/virtual.c +@@ -570,8 +570,16 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step, + return start; + TRACE( "Found free area is already mapped, start %p.\n", start ); + +- if (ptr != (void *)-1) ++ if (ptr == (void *)-1) ++ { ++ ERR("wine_anon_mmap() error %s, start %p, size %p, unix_prot %#x.\n", ++ strerror(errno), start, (void *)size, unix_prot); ++ return NULL; ++ } ++ else ++ { + munmap( ptr, size ); ++ } + + if ((step > 0 && (char *)end - (char *)start < step) || + (step < 0 && (char *)start - (char *)base < -step) || +-- +2.24.1 + diff --git a/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch b/patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch similarity index 100% rename from patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch rename to patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 9ad7d52a..1028198d 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4841,8 +4841,10 @@ fi # | * dlls/ntdll/virtual.c # | if test "$enable_ntdll_ForceBottomUpAlloc" -eq 1; then - patch_apply ntdll-ForceBottomUpAlloc/0001-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch + patch_apply ntdll-ForceBottomUpAlloc/0001-ntdll-Stop-search-on-mmap-error-in-try_map_free_area.patch + patch_apply ntdll-ForceBottomUpAlloc/0002-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch ( + printf '%s\n' '+ { "Paul Gofman", "ntdll: Stop search on mmap() error in try_map_free_area().", 1 },'; printf '%s\n' '+ { "Paul Gofman", "ntdll: Force bottom up allocation order for 64 bit arch unless top down is requested.", 1 },'; ) >> "$patchlist" fi