From c55ec6993911fa820fa3c2046e4ef70d0f160fc0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sun, 3 Dec 2023 15:28:46 -0600 Subject: [PATCH] ntdll-ForceBottomUpAlloc: fix a crash in debug.c:init_options(). After upstream commit 62a979347a4dc1bd68f79b86397de85c016ec588 any TRACE() present on the way of virtual_init() will cause a crash with WINEDEBUG present regardless of actual debug channels. Avoid TRACE in virtual_init(). --- ...step-after-failed-map-attempt-in-try_.patch | 2 +- ...free-ranges-view-block-size-on-64-bit.patch | 2 +- ...Force-virtual-memory-allocation-order.patch | 18 +++++------------- ...atively-mapped-areas-from-free-areas-.patch | 6 +++--- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch b/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch index 290f76c1..d19a473f 100644 --- a/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch +++ b/patches/ntdll-ForceBottomUpAlloc/0001-ntdll-Increase-step-after-failed-map-attempt-in-try_.patch @@ -1,4 +1,4 @@ -From 2cfc62af875b430912bbffcf37f4ffc4302734b5 Mon Sep 17 00:00:00 2001 +From 33961353f1d7e0590c83927e632a6d43b2a81fa2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jan 2020 21:39:23 +0300 Subject: [PATCH] ntdll: Increase step after failed map attempt in diff --git a/patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Increase-free-ranges-view-block-size-on-64-bit.patch b/patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Increase-free-ranges-view-block-size-on-64-bit.patch index e1295e61..a5ab820b 100644 --- a/patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Increase-free-ranges-view-block-size-on-64-bit.patch +++ b/patches/ntdll-ForceBottomUpAlloc/0002-ntdll-Increase-free-ranges-view-block-size-on-64-bit.patch @@ -1,4 +1,4 @@ -From c00a800b3246b57ade14cddd7fa076f9d63fe151 Mon Sep 17 00:00:00 2001 +From d853eba76fd849e21b5cb4ce0a3f113ba9beea87 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Jul 2020 18:40:39 +0300 Subject: [PATCH] ntdll: Increase free ranges view block size on 64 bit. diff --git a/patches/ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch b/patches/ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch index 4cf08726..61abb5c5 100644 --- a/patches/ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch +++ b/patches/ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch @@ -1,4 +1,4 @@ -From 89030b137479fd06a498020327dfc54593fc9c57 Mon Sep 17 00:00:00 2001 +From 22f53694277313639b0ca00f6f075407839737e7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Nov 2019 12:19:20 +0300 Subject: [PATCH] ntdll: Force virtual memory allocation order. @@ -12,11 +12,11 @@ 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 | 411 +++++++++++++++----------------------- - 1 file changed, 165 insertions(+), 246 deletions(-) + dlls/ntdll/unix/virtual.c | 410 +++++++++++++++----------------------- + 1 file changed, 164 insertions(+), 246 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 30d0df85fba..fe6dc86c80b 100644 +index 30d0df85fba..a14bbb852f8 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1246,43 +1246,15 @@ static struct file_view *find_view_range( const void *addr, size_t size ) @@ -503,15 +503,7 @@ index 30d0df85fba..fe6dc86c80b 100644 return res; } -@@ -3283,6 +3200,7 @@ void virtual_init(void) - if (preload_reserve_start) - address_space_start = min( address_space_start, preload_reserve_start ); - } -+ TRACE("preload reserve %p-%p.\n", preload_reserve_start, preload_reserve_end); - } - - /* try to find space in a reserved area for the views and pages protection table */ -@@ -6110,6 +6028,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL +@@ -6110,6 +6027,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL *ret = (ULONG_PTR)base; *size_ptr = size; } diff --git a/patches/ntdll-ForceBottomUpAlloc/0004-ntdll-Exclude-natively-mapped-areas-from-free-areas-.patch b/patches/ntdll-ForceBottomUpAlloc/0004-ntdll-Exclude-natively-mapped-areas-from-free-areas-.patch index 230bb37e..5bb20733 100644 --- a/patches/ntdll-ForceBottomUpAlloc/0004-ntdll-Exclude-natively-mapped-areas-from-free-areas-.patch +++ b/patches/ntdll-ForceBottomUpAlloc/0004-ntdll-Exclude-natively-mapped-areas-from-free-areas-.patch @@ -1,4 +1,4 @@ -From fa77cda3f27c53e907b9dce6d15dd767be73bd85 Mon Sep 17 00:00:00 2001 +From 7c62f566f9b48dacab5cc79dac496f498aaae68b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Dec 2023 14:55:20 -0600 Subject: [PATCH] ntdll: Exclude natively mapped areas from free areas list. @@ -8,7 +8,7 @@ Subject: [PATCH] ntdll: Exclude natively mapped areas from free areas list. 1 file changed, 95 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index fe6dc86c80b..c0698e15eb6 100644 +index a14bbb852f8..491597dcb76 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -127,6 +127,7 @@ struct file_view @@ -196,7 +196,7 @@ index fe6dc86c80b..c0698e15eb6 100644 } status = create_view( view_ret, ptr, size, vprot ); if (status != STATUS_SUCCESS) unmap_area( ptr, size ); -@@ -4256,7 +4337,12 @@ void virtual_set_force_exec( BOOL enable ) +@@ -4255,7 +4336,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 */