[PATCH 1/2] ntdll: Stop search on mmap() error in try_map_free_area().
Paul Gofman
pgofman at codeweavers.com
Fri Jul 10 06:39:20 CDT 2020
The anon mmap errors do not depend on start address hint. Ignoring them
makes the search take incredible time until it fails.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/ntdll/unix/virtual.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 868dd570551..5636d1b5f8d 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1009,8 +1009,14 @@ 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)
- munmap( ptr, size );
+ if (ptr == (void *)-1)
+ {
+ ERR( "wine_anon_mmap() error %s, range %p-%p, unix_prot %#x.\n",
+ strerror(errno), start, (char *)start + size, unix_prot );
+ return NULL;
+ }
+
+ munmap( ptr, size );
if ((step > 0 && (char *)end - (char *)start < step) ||
(step < 0 && (char *)start - (char *)base < -step) ||
--
2.26.2
More information about the wine-devel
mailing list