Paul Gofman : ntdll: Stop search on mmap() error in try_map_free_area().
Alexandre Julliard
julliard at winehq.org
Mon Jul 13 16:08:50 CDT 2020
Module: wine
Branch: master
Commit: 5498ebd8c0aaa651ce6823cccdf572a3f551deba
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5498ebd8c0aaa651ce6823cccdf572a3f551deba
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Fri Jul 10 14:39:20 2020 +0300
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.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 4e5b1acf0b..20bf5ff066 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) ||
More information about the wine-cvs
mailing list