Rebase against 91494ae6f2e47254d15a47e292ff569f3b400be6.

This commit is contained in:
Zebediah Figura 2021-08-11 22:25:44 -05:00
parent 16476ce303
commit 1bc4da9d59
8 changed files with 58 additions and 132 deletions

View File

@ -1,4 +1,4 @@
From 03e143d7abd6684600722fee6c96d05d2c70830d Mon Sep 17 00:00:00 2001
From e127c088e6f4cfae3066b31adcd73c4eee9008ed Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Mon, 25 Nov 2019 12:19:20 +0300
Subject: [PATCH] ntdll: Force virtual memory allocation order.
@ -12,14 +12,14 @@ are from higher memory than they expect.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48175
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46568
---
dlls/ntdll/unix/virtual.c | 418 ++++++++++++++++++--------------------
1 file changed, 202 insertions(+), 216 deletions(-)
dlls/ntdll/unix/virtual.c | 421 ++++++++++++++++++--------------------
1 file changed, 204 insertions(+), 217 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 75fa0b91872..525c55b8097 100644
index 606e136dfaa..4899fc7b443 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1135,44 +1135,6 @@ static struct file_view *find_view_range( const void *addr, size_t size )
@@ -1217,44 +1217,6 @@ static struct file_view *find_view_range( const void *addr, size_t size )
}
@ -64,7 +64,7 @@ index 75fa0b91872..525c55b8097 100644
/***********************************************************************
* try_map_free_area
*
@@ -1205,110 +1167,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
@@ -1287,110 +1249,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
return NULL;
}
@ -175,7 +175,7 @@ index 75fa0b91872..525c55b8097 100644
/***********************************************************************
* add_reserved_area
*
@@ -1466,8 +1324,7 @@ static void delete_view( struct file_view *view ) /* [in] View */
@@ -1548,8 +1406,7 @@ static void delete_view( struct file_view *view ) /* [in] View */
{
if (!(view->protect & VPROT_SYSTEM)) unmap_area( view->base, view->size );
set_page_vprot( view->base, view->size, 0 );
@ -185,7 +185,7 @@ index 75fa0b91872..525c55b8097 100644
wine_rb_remove( &views_tree, &view->entry );
*(struct file_view **)view = next_free_view;
next_free_view = view;
@@ -1515,8 +1372,7 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
@@ -1597,8 +1454,7 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
set_page_vprot( base, size, vprot );
wine_rb_put( &views_tree, view->base, &view->entry );
@ -195,11 +195,8 @@ index 75fa0b91872..525c55b8097 100644
*view_ret = view;
@@ -1741,54 +1597,220 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
return ptr;
}
@@ -1812,51 +1668,218 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
-
struct alloc_area
{
+ char *map_area_start, *map_area_end, *result;
@ -217,20 +214,20 @@ index 75fa0b91872..525c55b8097 100644
- *
- * Try to map some space inside a reserved area. Callback for mmap_enum_reserved_areas.
- */
-static int CDECL alloc_reserved_area_callback( void *start, SIZE_T size, void *arg )
+static int CDECL alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size, void *arg )
-static int alloc_reserved_area_callback( void *start, SIZE_T size, void *arg )
+static int alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size, void *arg )
{
- struct alloc_area *alloc = arg;
- void *end = (char *)start + size;
-
- if (start < address_space_start) start = address_space_start;
- if (is_beyond_limit( start, size, alloc->limit )) end = alloc->limit;
- if (start >= end) return 0;
+ char *intersect_start, *intersect_end;
+ char *end = (char *)start + size;
+ struct alloc_area *area = arg;
+ char *alloc_start;
- if (start < address_space_start) start = address_space_start;
- if (is_beyond_limit( start, size, alloc->limit )) end = alloc->limit;
- if (start >= end) return 0;
-
- /* make sure we don't touch the preloader reserved range */
- if (preload_reserve_end >= start)
+ if (area->top_down)
@ -253,13 +250,20 @@ index 75fa0b91872..525c55b8097 100644
{
- if (preload_reserve_start <= start) return 0; /* no space in that area */
- if (preload_reserve_start < end) end = preload_reserve_start;
- }
- else if (preload_reserve_start <= start) start = preload_reserve_end;
- else
- {
- /* range is split in two by the preloader reservation, try first part */
- if ((alloc->result = find_reserved_free_area( start, preload_reserve_start, alloc->size,
- alloc->top_down )))
+ alloc_start = ROUND_ADDR( (char *)area->map_area_end - size, granularity_mask );
+ if ((area->result = try_map_free_area( intersect_end, alloc_start + size, area->step,
+ alloc_start, area->size, area->unix_prot )))
+ return 1;
return 1;
- /* then fall through to try second part */
- start = preload_reserve_end;
}
- else if (preload_reserve_start <= start) start = preload_reserve_end;
- else
+
+ if (intersect_end - intersect_start >= area->size)
+ {
@ -291,16 +295,11 @@ index 75fa0b91872..525c55b8097 100644
+ assert(ROUND_ADDR(area->map_area_start, granularity_mask) == area->map_area_start);
+
+ if (intersect_start - area->map_area_start >= area->size)
{
- /* range is split in two by the preloader reservation, try first part */
- if ((alloc->result = find_reserved_free_area( start, preload_reserve_start, alloc->size,
- alloc->top_down )))
+ {
+ if ((area->result = try_map_free_area( area->map_area_start, intersect_start, area->step,
+ area->map_area_start, area->size, area->unix_prot )))
return 1;
- /* then fall through to try second part */
- start = preload_reserve_end;
}
+ return 1;
+ }
+
+ if (intersect_end - intersect_start >= area->size)
+ {
@ -446,7 +445,7 @@ index 75fa0b91872..525c55b8097 100644
/***********************************************************************
* map_fixed_area
*
@@ -1860,48 +1882,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1928,48 +1951,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
if (status != STATUS_SUCCESS) return status;
ptr = base;
}
@ -498,7 +497,7 @@ index 75fa0b91872..525c55b8097 100644
status = create_view( view_ret, ptr, size, vprot );
if (status != STATUS_SUCCESS) unmap_area( ptr, size );
return status;
@@ -2627,6 +2612,7 @@ void virtual_init(void)
@@ -2695,6 +2681,7 @@ void virtual_init(void)
if (preload_reserve_start)
address_space_start = min( address_space_start, preload_reserve_start );
}

View File

@ -1,4 +1,4 @@
From 9d123ae160a93e689b35e50682405f421d094c18 Mon Sep 17 00:00:00 2001
From bcc882f5d1980cbf353891d1e1686e97c068f8c7 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Tue, 2 Jun 2020 21:06:33 +0300
Subject: [PATCH] ntdll: Exclude natively mapped areas from free areas list.
@ -8,10 +8,10 @@ Subject: [PATCH] ntdll: Exclude natively mapped areas from free areas list.
1 file changed, 109 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index cee8d1d5041..7c26c79649e 100644
index 4899fc7b443..cee739bd942 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -116,6 +116,7 @@ struct file_view
@@ -143,6 +143,7 @@ struct file_view
#define VPROT_WRITEWATCH 0x40
/* per-mapping protection flags */
#define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */
@ -19,7 +19,7 @@ index cee8d1d5041..7c26c79649e 100644
/* Conversion from VPROT_* to Win32 flags */
static const BYTE VIRTUAL_Win32Flags[16] =
@@ -999,7 +1000,9 @@ static void dump_view( struct file_view *view )
@@ -1081,7 +1082,9 @@ static void dump_view( struct file_view *view )
BYTE prot = get_page_vprot( addr );
TRACE( "View: %p - %p", addr, addr + view->size - 1 );
@ -30,7 +30,7 @@ index cee8d1d5041..7c26c79649e 100644
TRACE( " (builtin image)\n" );
else if (view->protect & SEC_IMAGE)
TRACE( " (image)\n" );
@@ -1134,6 +1137,16 @@ static struct file_view *find_view_range( const void *addr, size_t size )
@@ -1216,6 +1219,16 @@ static struct file_view *find_view_range( const void *addr, size_t size )
return NULL;
}
@ -47,7 +47,7 @@ index cee8d1d5041..7c26c79649e 100644
/***********************************************************************
* try_map_free_area
@@ -1141,21 +1154,27 @@ static struct file_view *find_view_range( const void *addr, size_t size )
@@ -1223,21 +1236,27 @@ static struct file_view *find_view_range( const void *addr, size_t size )
* Try mmaping some expected free memory region, eventually stepping and
* retrying inside it, and return where it actually succeeded, or NULL.
*/
@ -80,10 +80,10 @@ index cee8d1d5041..7c26c79649e 100644
if ((step > 0 && (char *)end - (char *)start < step) ||
(step < 0 && (char *)start - (char *)base < -step) ||
step == 0)
@@ -1597,15 +1616,6 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
return ptr;
@@ -1666,15 +1685,6 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
}
-struct alloc_area
-{
- char *map_area_start, *map_area_end, *result;
@ -93,10 +93,10 @@ index cee8d1d5041..7c26c79649e 100644
- BOOL top_down;
-};
-
static int CDECL alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size, void *arg )
static int alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size, void *arg )
{
char *intersect_start, *intersect_end;
@@ -1631,8 +1641,8 @@ static int CDECL alloc_area_in_reserved_or_between_callback( void *start, SIZE_T
@@ -1700,8 +1710,8 @@ static int alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size,
if (area->map_area_end - intersect_end >= area->size)
{
alloc_start = ROUND_ADDR( (char *)area->map_area_end - size, granularity_mask );
@ -107,7 +107,7 @@ index cee8d1d5041..7c26c79649e 100644
return 1;
}
@@ -1667,8 +1677,8 @@ static int CDECL alloc_area_in_reserved_or_between_callback( void *start, SIZE_T
@@ -1736,8 +1746,8 @@ static int alloc_area_in_reserved_or_between_callback( void *start, SIZE_T size,
if (intersect_start - area->map_area_start >= area->size)
{
@ -118,7 +118,7 @@ index cee8d1d5041..7c26c79649e 100644
return 1;
}
@@ -1723,8 +1733,7 @@ static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char
@@ -1792,8 +1802,7 @@ static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char
if (start >= area->map_area_end || start < area->map_area_start)
return NULL;
@ -128,7 +128,7 @@ index cee8d1d5041..7c26c79649e 100644
}
else
{
@@ -1733,8 +1742,7 @@ static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char
@@ -1802,8 +1811,7 @@ static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char
|| area->map_area_end - start < area->size)
return NULL;
@ -138,7 +138,7 @@ index cee8d1d5041..7c26c79649e 100644
}
}
@@ -1744,6 +1752,7 @@ static void *alloc_free_area( void *limit, size_t size, BOOL top_down, int unix_
@@ -1813,6 +1821,7 @@ static void *alloc_free_area( void *limit, size_t size, BOOL top_down, int unix_
char *reserve_start, *reserve_end;
struct alloc_area area;
char *base, *end;
@ -146,7 +146,7 @@ index cee8d1d5041..7c26c79649e 100644
int ranges_inc;
TRACE("limit %p, size %p, top_down %#x.\n", limit, (void *)size, top_down);
@@ -1799,16 +1808,67 @@ static void *alloc_free_area( void *limit, size_t size, BOOL top_down, int unix_
@@ -1868,16 +1877,67 @@ static void *alloc_free_area( void *limit, size_t size, BOOL top_down, int unix_
{
/* range is split in two by the preloader reservation, try first part. */
if ((area.result = alloc_free_area_in_range( &area, base, reserve_start )))
@ -217,7 +217,7 @@ index cee8d1d5041..7c26c79649e 100644
}
/***********************************************************************
@@ -1862,6 +1922,17 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
@@ -1931,6 +1991,17 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
return STATUS_SUCCESS;
}
@ -235,7 +235,7 @@ index cee8d1d5041..7c26c79649e 100644
/***********************************************************************
* map_view
*
@@ -1885,7 +1956,12 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1954,7 +2025,12 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
else if (!(ptr = alloc_free_area( (void*)(get_zero_bits_mask( zero_bits )
& (UINT_PTR)user_space_limit), size, top_down, get_unix_prot( vprot ) )))
{
@ -249,7 +249,7 @@ index cee8d1d5041..7c26c79649e 100644
}
status = create_view( view_ret, ptr, size, vprot );
if (status != STATUS_SUCCESS) unmap_area( ptr, size );
@@ -3538,7 +3614,12 @@ void virtual_set_force_exec( BOOL enable )
@@ -3646,7 +3722,12 @@ void virtual_set_force_exec( BOOL enable )
WINE_RB_FOR_EACH_ENTRY( view, &views_tree, struct file_view, entry )
{
/* file mappings are always accessible */

View File

@ -1,4 +1,4 @@
From 27c9c2851bb3629cb47134efe3a2162bca80aca6 Mon Sep 17 00:00:00 2001
From 9d760a7c86cff579f870d78d0d5b4a6624b22324 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sun, 22 Nov 2020 22:37:33 -0700
Subject: [PATCH] ntdll: Allow set_file_times_precise to work on reparse
@ -11,12 +11,12 @@ Subject: [PATCH] ntdll: Allow set_file_times_precise to work on reparse
3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index f80fbd737ef..fb71556cfa3 100644
index 4b7d72063d8..0a15b7b92ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2223,7 +2223,8 @@ AC_CHECK_FUNCS(\
sigprocmask \
@@ -2224,7 +2224,8 @@ AC_CHECK_FUNCS(\
symlink \
sysinfo \
tcdrain \
- thr_kill2
+ thr_kill2 \
@ -65,10 +65,10 @@ index 490d5160761..2449ee54799 100644
CloseHandle(handle);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a84062df272..185f7e3bbeb 100644
index 2ee9288f500..2f0ec520288 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1731,6 +1731,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1728,6 +1728,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
}
@ -83,7 +83,7 @@ index a84062df272..185f7e3bbeb 100644
#if defined(__ANDROID__) && !defined(HAVE_FUTIMENS)
static int futimens( int fd, const struct timespec spec[2] )
{
@@ -1746,7 +1754,7 @@ static int futimens( int fd, const struct timespec spec[2] )
@@ -1743,7 +1751,7 @@ static int futimens( int fd, const struct timespec spec[2] )
static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
const LARGE_INTEGER *atime, NTSTATUS *status )
{
@ -92,7 +92,7 @@ index a84062df272..185f7e3bbeb 100644
struct timespec tv[2];
tv[0].tv_sec = tv[1].tv_sec = 0;
@@ -1762,10 +1770,16 @@ static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
@@ -1759,10 +1767,16 @@ static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
tv[1].tv_nsec = (mtime->QuadPart % 10000000) * 100;
}
#ifdef __APPLE__

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "f63ecaedc72f3580e7016ba71a480025e4d86e99"
echo "91494ae6f2e47254d15a47e292ff569f3b400be6"
}
# Show version information
@ -240,7 +240,6 @@ patch_enable_all ()
enable_windowscodecs_TIFF_Support="$1"
enable_wine_inf_Directory_ContextMenuHandlers="$1"
enable_wine_inf_Dummy_CA_Certificate="$1"
enable_wine_inf_Performance="$1"
enable_wineboot_HKEY_DYN_DATA="$1"
enable_wineboot_ProxySettings="$1"
enable_winecfg_Libraries="$1"
@ -761,9 +760,6 @@ patch_enable ()
wine.inf-Dummy_CA_Certificate)
enable_wine_inf_Dummy_CA_Certificate="$2"
;;
wine.inf-Performance)
enable_wine_inf_Performance="$2"
;;
wineboot-HKEY_DYN_DATA)
enable_wineboot_HKEY_DYN_DATA="$2"
;;
@ -3727,20 +3723,6 @@ if test "$enable_wine_inf_Dummy_CA_Certificate" -eq 1; then
patch_apply wine.inf-Dummy_CA_Certificate/0001-wine.inf.in-Add-invalid-dummy-certificate-to-CA-cert.patch
fi
# Patchset wine.inf-Performance
# |
# | This patchset fixes the following Wine bugs:
# | * [#33661] Add performance library registry keys needed by MS SQL Server Management Studio Express 2008 R2
# | * [#33037] Visual Studio 6 can't be installed with WinVer >= Win2K (missing HKEY_PERFORMANCE_DATA 230, process object)
# |
# | Modified files:
# | * loader/wine.inf.in
# |
if test "$enable_wine_inf_Performance" -eq 1; then
patch_apply wine.inf-Performance/0001-wine.inf-Add-registry-keys-for-Windows-Performance-L.patch
patch_apply wine.inf-Performance/0002-wine.inf-Add-Counters-to-the-perflib-key-as-an-alias.patch
fi
# Patchset wineboot-HKEY_DYN_DATA
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,27 +0,0 @@
From cb92c3e3611dd8d8d97992b79e1c9fc449ff2569 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1@gmail.com>
Date: Sun, 8 Feb 2015 06:32:34 +0100
Subject: wine.inf: Add registry keys for Windows Performance Library.
---
loader/wine.inf.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 315ef29..2de7e61 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -492,6 +492,10 @@ HKLM,%CurrentVersionNT%\Language Pack,,16
HKLM,%CurrentVersionNT%\NetworkCards,,16
HKLM,%CurrentVersionNT%\OpenGLDrivers,,16
HKLM,%CurrentVersionNT%\Perflib,,16
+HKLM,%CurrentVersionNT%\Perflib,Last Counter,0x10003,1846
+HKLM,%CurrentVersionNT%\Perflib,Last Help,0x10003,1847
+HKLM,%CurrentVersionNT%\Perflib\009,Counter,0x10002,1,1847,1846,End Marker
+HKLM,%CurrentVersionNT%\Perflib\009,Help,0x10002,1847,End Marker
HKLM,%CurrentVersionNT%\Ports,,16
HKLM,%CurrentVersionNT%\Print,,16
HKLM,%CurrentVersionNT%\ProfileList,,16
--
2.4.5

View File

@ -1,26 +0,0 @@
From 9a3d921b80c5c602bbb130457f0f67c79da44660 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 23 May 2017 14:59:15 +0800
Subject: wine.inf: Add 'Counters' to the perflib key as an alias for
'Counter'.
Visual Studio 6.0 setup depends on this.
---
loader/wine.inf.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 6f6ae55b0f7..7fa93a62630 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -522,6 +522,7 @@ HKLM,%CurrentVersionNT%\Perflib,,16
HKLM,%CurrentVersionNT%\Perflib,Last Counter,0x10003,1846
HKLM,%CurrentVersionNT%\Perflib,Last Help,0x10003,1847
HKLM,%CurrentVersionNT%\Perflib\009,Counter,0x10002,1,1847,1846,End Marker
+HKLM,%CurrentVersionNT%\Perflib\009,Counters,0x10002,1,1847,1846,End Marker
HKLM,%CurrentVersionNT%\Perflib\009,Help,0x10002,1847,End Marker
HKLM,%CurrentVersionNT%\Ports,,16
HKLM,%CurrentVersionNT%\Print,,16
--
2.12.2

View File

@ -1,2 +0,0 @@
Fixes: [33661] Add performance library registry keys needed by MS SQL Server Management Studio Express 2008 R2
Fixes: [33037] Visual Studio 6 can't be installed with WinVer >= Win2K (missing HKEY_PERFORMANCE_DATA 230, process object)

View File

@ -1 +1 @@
f63ecaedc72f3580e7016ba71a480025e4d86e99
91494ae6f2e47254d15a47e292ff569f3b400be6