Rebase against fdb3d9ae320363c1bd9fa716b167a7ad313e638b.

This commit is contained in:
Zebediah Figura 2020-07-13 17:56:04 -05:00
parent 4d315a6098
commit 913b39b117
5 changed files with 11 additions and 101 deletions

View File

@ -1,35 +0,0 @@
From 980ca40adb1f4d268b42f434c353dc461df19b49 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/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 04889113c339..088e73b17b34 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1063,8 +1063,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, start %p, size %p, unix_prot %#x.\n",
+ strerror(errno), start, (void *)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

View File

@ -1,51 +0,0 @@
From 1aa1c57302aef175849799185f324e461161f9eb Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Thu, 16 Jan 2020 16:09:24 +0300
Subject: [PATCH] ntdll: Use MAP_FIXED_NOREPLACE flag in try_map_free_area() if
available.
Avoids actual mapping followed by unmapping back if the memory range is
already mapped.
---
dlls/ntdll/unix/virtual.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 088e73b17b34..3907b0db70a9 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1055,22 +1055,28 @@ static struct wine_rb_entry *find_view_inside_range( void **base_ptr, void **end
static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
void *start, size_t size, int unix_prot )
{
+#ifdef MAP_FIXED_NOREPLACE
+ static int flags = MAP_FIXED_NOREPLACE;
+#else
+ static int flags = 0;
+#endif
void *ptr;
while (start && base <= start && (char*)start + size <= (char*)end)
{
- if ((ptr = wine_anon_mmap( start, size, unix_prot, 0 )) == start)
+ if ((ptr = wine_anon_mmap( start, size, unix_prot, flags )) == start)
return start;
TRACE( "Found free area is already mapped, start %p.\n", start );
- if (ptr == (void *)-1)
+ if (ptr == (void *)-1 && errno != EEXIST)
{
ERR("wine_anon_mmap() error %s, start %p, size %p, unix_prot %#x.\n",
strerror(errno), start, (void *)size, unix_prot);
return NULL;
}
- munmap( ptr, size );
+ if (ptr != (void *)-1)
+ munmap( ptr, size );
if ((step > 0 && (char *)end - (char *)start < step) ||
(step < 0 && (char *)start - (char *)base < -step) ||
--
2.26.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "caa41d4917a84dbbeb4aa14f18cfecfd17efe71a"
echo "fdb3d9ae320363c1bd9fa716b167a7ad313e638b"
}
# Show version information
@ -3536,15 +3536,11 @@ fi
# | * dlls/ntdll/unix/virtual.c
# |
if test "$enable_ntdll_ForceBottomUpAlloc" -eq 1; then
patch_apply ntdll-ForceBottomUpAlloc/0001-ntdll-Stop-search-on-mmap-error-in-try_map_free_area.patch
patch_apply ntdll-ForceBottomUpAlloc/0002-ntdll-Use-MAP_FIXED_NOREPLACE-flag-in-try_map_free_a.patch
patch_apply ntdll-ForceBottomUpAlloc/0003-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch
patch_apply ntdll-ForceBottomUpAlloc/0004-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch
patch_apply ntdll-ForceBottomUpAlloc/0005-ntdll-Use-free-area-list-for-virtual-memory-allocati.patch
patch_apply ntdll-ForceBottomUpAlloc/0006-ntdll-Permanently-exclude-natively-mapped-areas-from.patch
(
printf '%s\n' '+ { "Paul Gofman", "ntdll: Stop search on mmap() error in try_map_free_area().", 1 },';
printf '%s\n' '+ { "Paul Gofman", "ntdll: Use MAP_FIXED_NOREPLACE flag in try_map_free_area() if available.", 1 },';
printf '%s\n' '+ { "Paul Gofman", "ntdll: Force bottom up allocation order for 64 bit arch unless top down is requested.", 1 },';
printf '%s\n' '+ { "Paul Gofman", "ntdll: Increase step after failed map attempt in try_map_free_area().", 1 },';
printf '%s\n' '+ { "Paul Gofman", "ntdll: Use free area list for virtual memory allocation.", 1 },';

View File

@ -1,4 +1,4 @@
From a82fe5d2ad7ff0683ca7078dffb232676ea8a16f Mon Sep 17 00:00:00 2001
From 63e07d8738f715c04fe46d2e50e63b8a46b707af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 19:39:29 +0100
Subject: [PATCH] ntdll: Mimic object type behavior for different windows
@ -119,10 +119,10 @@ index 398ad6bed4e..b538160f6d0 100644
test_case_sensitive();
test_namespace_pipe();
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 4544df55d16..8ff963585da 100644
index ace1b98e534..f9aa98ca559 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6462,7 +6462,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
@@ -6488,7 +6488,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
}
if (status == STATUS_SUCCESS)
{
@ -135,11 +135,11 @@ index 4544df55d16..8ff963585da 100644
}
}
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index cd2f45d9f55..b56747e0273 100644
index a795d56e8bc..785a714e88a 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2024,6 +2024,18 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi )
RtlLeaveCriticalSection( &TIME_tz_section );
@@ -1992,6 +1992,18 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi )
pthread_mutex_unlock( &tz_mutex );
}
+static DWORD translate_object_index(DWORD index)
@ -157,7 +157,7 @@ index cd2f45d9f55..b56747e0273 100644
/******************************************************************************
* NtQuerySystemInformation (NTDLL.@)
@@ -2390,7 +2402,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2396,7 +2408,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].OwnerPid = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].AccessMask = handle_info[i].access;
@ -166,7 +166,7 @@ index cd2f45d9f55..b56747e0273 100644
/* FIXME: Fill out HandleFlags, ObjectPointer */
}
}
@@ -2443,7 +2455,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2449,7 +2461,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].UniqueProcessId = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].GrantedAccess = handle_info[i].access;
@ -175,7 +175,7 @@ index cd2f45d9f55..b56747e0273 100644
/* FIXME: Fill out remaining fields */
}
}
@@ -2663,7 +2675,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2669,7 +2681,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
return ret;
}

View File

@ -1 +1 @@
caa41d4917a84dbbeb4aa14f18cfecfd17efe71a
fdb3d9ae320363c1bd9fa716b167a7ad313e638b