Updated ntdll-ForceBottomUpAlloc patchset

Fixes hang on start in Far Cry 5.
This commit is contained in:
Paul Gofman 2020-01-09 15:17:29 +03:00
parent f05f084d9a
commit 89af635b94
3 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From d326b5e1f14765fed43f674f3693bb881c9e2c55 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
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

View File

@ -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