mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
ntdll-Virtual_Memory_Stack: Disable patchset, it has no effect when optimization is enabled.
This commit is contained in:
parent
d2f012b3d1
commit
fd66b3bced
@ -1,4 +1,4 @@
|
||||
From 25288a6031d1a4cf1a7e409eb06ac234d21761ac Mon Sep 17 00:00:00 2001
|
||||
From 1a619eb84978df08b8f0baebfbd5cc8b02f19a47 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 21 Aug 2015 06:39:47 +0800
|
||||
Subject: ntdll: Do not allow to deallocate thread stack for current thread.
|
||||
@ -133,7 +133,7 @@ index 886da86..90644a4 100644
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
|
||||
index 575a770..2ced91e 100644
|
||||
index 524de68..d3885eb 100644
|
||||
--- a/dlls/ntdll/signal_x86_64.c
|
||||
+++ b/dlls/ntdll/signal_x86_64.c
|
||||
@@ -2732,12 +2732,19 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
||||
@ -157,19 +157,19 @@ index 575a770..2ced91e 100644
|
||||
NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
|
||||
}
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 020a6c0..98de9e6 100644
|
||||
index 4d4bc3b..eb76cee 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -1469,6 +1469,8 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi
|
||||
@@ -1453,6 +1453,8 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi
|
||||
teb->DeallocationStack = view->base;
|
||||
teb->Tib.StackBase = (char *)view->base + view->size;
|
||||
teb->Tib.StackLimit = (char *)view->base + 2 * page_size;
|
||||
+ ((struct ntdll_thread_data *)teb->SpareBytes1)->pthread_stack = view->base;
|
||||
+
|
||||
done:
|
||||
virtual_unlock();
|
||||
server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||
return status;
|
||||
@@ -2060,6 +2062,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
@@ -2048,6 +2050,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
/* Free the pages */
|
||||
|
||||
if (size || (base != view->base)) status = STATUS_INVALID_PARAMETER;
|
||||
@ -187,5 +187,5 @@ index 020a6c0..98de9e6 100644
|
||||
{
|
||||
delete_view( view );
|
||||
--
|
||||
2.5.1
|
||||
2.6.1
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
Fixes: Do not allow to deallocate thread stack for current thread
|
||||
Depends: ntdll-Virtual_Memory_Stack
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 134f935483d49fad68e814d21a30f483f606d386 Mon Sep 17 00:00:00 2001
|
||||
From a903fc237899e6fd92f1604c33c12d12bfbad9ca Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Wed, 20 Aug 2014 19:21:18 +0200
|
||||
Subject: ntdll: Move NtProtectVirtualMemory and NtCreateSection to separate
|
||||
@ -9,12 +9,12 @@ Subject: ntdll: Move NtProtectVirtualMemory and NtCreateSection to separate
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 020a6c0..592d65f 100644
|
||||
index 4d4bc3b..4179dba 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -170,6 +170,14 @@ static void virtual_unlock(void)
|
||||
else RtlLeaveCriticalSection( &csVirtual );
|
||||
}
|
||||
@@ -149,6 +149,14 @@ static void *preload_reserve_end;
|
||||
static BOOL use_locks;
|
||||
static BOOL force_exec_prot; /* whether to force PROT_EXEC on all PROT_READ mmaps */
|
||||
|
||||
+#if defined(__i386__)
|
||||
+NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr,
|
||||
@ -24,9 +24,9 @@ index 020a6c0..592d65f 100644
|
||||
+ ULONG sec_flags, HANDLE file ) DECLSPEC_ALIGN(4096);
|
||||
+#endif
|
||||
+
|
||||
|
||||
/***********************************************************************
|
||||
* VIRTUAL_GetProtStr
|
||||
*/
|
||||
--
|
||||
2.5.1
|
||||
2.6.1
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
Fixes: [33162] Ensure NtProtectVirtualMemory and NtCreateSection are on separate pages
|
||||
Depends: ntdll-Virtual_Memory_Stack
|
||||
Category: stable
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Most distributions compile Wine with optimizations enabled, unfortunately
|
||||
# the patch doesn't help then. Do not claim its fixed until it works everywhere.
|
||||
# Fixes: [34558] Reduce stack usage of virtual memory functions
|
||||
Disabled: true
|
||||
|
@ -209,7 +209,6 @@ patch_enable_all ()
|
||||
enable_ntdll_ThreadTime="$1"
|
||||
enable_ntdll_Threading="$1"
|
||||
enable_ntdll_User_Shared_Data="$1"
|
||||
enable_ntdll_Virtual_Memory_Stack="$1"
|
||||
enable_ntdll_WRITECOPY="$1"
|
||||
enable_ntdll_Wait_User_APC="$1"
|
||||
enable_ntdll_WinSqm="$1"
|
||||
@ -723,9 +722,6 @@ patch_enable ()
|
||||
ntdll-User_Shared_Data)
|
||||
enable_ntdll_User_Shared_Data="$2"
|
||||
;;
|
||||
ntdll-Virtual_Memory_Stack)
|
||||
enable_ntdll_Virtual_Memory_Stack="$2"
|
||||
;;
|
||||
ntdll-WRITECOPY)
|
||||
enable_ntdll_WRITECOPY="$2"
|
||||
;;
|
||||
@ -1889,13 +1885,6 @@ if test "$enable_ntdll_NtQueryEaFile" -eq 1; then
|
||||
enable_ntdll_Syscall_Wrappers=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Fix_Alignment" -eq 1; then
|
||||
if test "$enable_ntdll_Virtual_Memory_Stack" -gt 1; then
|
||||
abort "Patchset ntdll-Virtual_Memory_Stack disabled, but ntdll-Fix_Alignment depends on that."
|
||||
fi
|
||||
enable_ntdll_Virtual_Memory_Stack=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_DllRedirects" -eq 1; then
|
||||
if test "$enable_ntdll_DllOverrides_WOW64" -gt 1; then
|
||||
abort "Patchset ntdll-DllOverrides_WOW64 disabled, but ntdll-DllRedirects depends on that."
|
||||
@ -1907,13 +1896,6 @@ if test "$enable_ntdll_DllRedirects" -eq 1; then
|
||||
enable_ntdll_Loader_Machine_Type=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Dealloc_Thread_Stack" -eq 1; then
|
||||
if test "$enable_ntdll_Virtual_Memory_Stack" -gt 1; then
|
||||
abort "Patchset ntdll-Virtual_Memory_Stack disabled, but ntdll-Dealloc_Thread_Stack depends on that."
|
||||
fi
|
||||
enable_ntdll_Virtual_Memory_Stack=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_DOS_Attributes" -eq 1; then
|
||||
if test "$enable_ntdll_Syscall_Wrappers" -gt 1; then
|
||||
abort "Patchset ntdll-Syscall_Wrappers disabled, but ntdll-DOS_Attributes depends on that."
|
||||
@ -2031,13 +2013,6 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then
|
||||
enable_ws2_32_WriteWatches=1
|
||||
fi
|
||||
|
||||
if test "$enable_ws2_32_WriteWatches" -eq 1; then
|
||||
if test "$enable_ntdll_Virtual_Memory_Stack" -gt 1; then
|
||||
abort "Patchset ntdll-Virtual_Memory_Stack disabled, but ws2_32-WriteWatches depends on that."
|
||||
fi
|
||||
enable_ntdll_Virtual_Memory_Stack=1
|
||||
fi
|
||||
|
||||
|
||||
# If autoupdate is enabled then create a tempfile to keep track of all patches
|
||||
if test "$enable_patchlist" -eq 1; then
|
||||
@ -2066,25 +2041,8 @@ if test "$enable_Compiler_Warnings" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Virtual_Memory_Stack
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/virtual.c
|
||||
# |
|
||||
if test "$enable_ntdll_Virtual_Memory_Stack" -eq 1; then
|
||||
patch_apply ntdll-Virtual_Memory_Stack/0001-ntdll-Reduce-stack-usage-by-storing-sigset-in-static.patch
|
||||
patch_apply ntdll-Virtual_Memory_Stack/0002-ntdll-Save-stack-in-NtAllocateVirtualMemory-by-movin.patch
|
||||
(
|
||||
echo '+ { "Michael Müller", "ntdll: Reduce stack usage by storing sigset in static memory.", 1 },';
|
||||
echo '+ { "Michael Müller", "ntdll: Save stack in NtAllocateVirtualMemory by moving remote memory allocation into separate function.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ws2_32-WriteWatches
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Virtual_Memory_Stack
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/signal_i386.c, dlls/ntdll/virtual.c, dlls/ws2_32/socket.c,
|
||||
# | include/winternl.h
|
||||
@ -2101,7 +2059,7 @@ fi
|
||||
# Patchset ntdll-WRITECOPY
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Virtual_Memory_Stack, ws2_32-WriteWatches
|
||||
# | * ws2_32-WriteWatches
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#29384] Voobly expects correct handling of WRITECOPY memory protection
|
||||
@ -2130,7 +2088,7 @@ fi
|
||||
# Patchset Exagear
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Virtual_Memory_Stack, ws2_32-WriteWatches, ntdll-WRITECOPY
|
||||
# | * ws2_32-WriteWatches, ntdll-WRITECOPY
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/ntdll/signal_i386.c, dlls/ntdll/virtual.c, server/ptrace.c
|
||||
@ -3938,9 +3896,6 @@ fi
|
||||
|
||||
# Patchset ntdll-Dealloc_Thread_Stack
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Virtual_Memory_Stack
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/signal_arm.c, dlls/ntdll/signal_arm64.c, dlls/ntdll/signal_i386.c,
|
||||
# | dlls/ntdll/signal_powerpc.c, dlls/ntdll/signal_x86_64.c, dlls/ntdll/virtual.c
|
||||
@ -4072,9 +4027,6 @@ fi
|
||||
|
||||
# Patchset ntdll-Fix_Alignment
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Virtual_Memory_Stack
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#33162] Ensure NtProtectVirtualMemory and NtCreateSection are on separate pages
|
||||
# |
|
||||
@ -4382,7 +4334,7 @@ fi
|
||||
# Patchset ntdll-WriteWatches
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * rpcrt4-Pipe_Transport, kernel32-Named_Pipe, ntdll-Virtual_Memory_Stack, ws2_32-WriteWatches
|
||||
# | * rpcrt4-Pipe_Transport, kernel32-Named_Pipe, ws2_32-WriteWatches
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/tests/virtual.c, dlls/ntdll/file.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
From b7a6d8f0acb9dca71c277ded977d6cf60240dbba Mon Sep 17 00:00:00 2001
|
||||
From 16bdcfee73240d725727f595f08e851b719e16c5 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 18 Mar 2015 23:03:01 +0100
|
||||
Subject: ntdll: Implement virtual_map_shared_memory.
|
||||
@ -6,8 +6,8 @@ Subject: ntdll: Implement virtual_map_shared_memory.
|
||||
Preparation for shared memory wineserver communication.
|
||||
---
|
||||
dlls/ntdll/ntdll_misc.h | 1 +
|
||||
dlls/ntdll/virtual.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 52 insertions(+)
|
||||
dlls/ntdll/virtual.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 53 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index cbd19db..7eded42 100644
|
||||
@ -22,10 +22,10 @@ index cbd19db..7eded42 100644
|
||||
extern BOOL virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
|
||||
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 91db4d6..8027556 100644
|
||||
index 4d4bc3b..8b422f4 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2734,6 +2734,57 @@ done:
|
||||
@@ -2729,6 +2729,58 @@ done:
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@ -37,6 +37,7 @@ index 91db4d6..8027556 100644
|
||||
+ SIZE_T size, mask = get_mask( zero_bits );
|
||||
+ struct file_view *view;
|
||||
+ unsigned int vprot;
|
||||
+ sigset_t sigset;
|
||||
+ NTSTATUS res;
|
||||
+ int prot;
|
||||
+
|
||||
@ -44,7 +45,7 @@ index 91db4d6..8027556 100644
|
||||
+ if (size < *size_ptr)
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ virtual_lock();
|
||||
+ server_enter_uninterrupted_section( &csVirtual, &sigset );
|
||||
+
|
||||
+ get_vprot_flags( protect, &vprot, FALSE );
|
||||
+ vprot |= VPROT_COMMITTED;
|
||||
@ -74,7 +75,7 @@ index 91db4d6..8027556 100644
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ virtual_unlock();
|
||||
+ server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
@ -84,5 +85,5 @@ index 91db4d6..8027556 100644
|
||||
* ZwUnmapViewOfSection (NTDLL.@)
|
||||
*/
|
||||
--
|
||||
2.5.1
|
||||
2.6.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From e09548baea24d9965e2beafc251bb69443424b25 Mon Sep 17 00:00:00 2001
|
||||
From c12454876971314ab43cf5519fa4534bbe962a62 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 3 Jan 2015 20:07:08 +0100
|
||||
Subject: ntdll: Expose wine_uninterrupted_[read|write]_memory as exports.
|
||||
@ -12,10 +12,10 @@ Subject: ntdll: Expose wine_uninterrupted_[read|write]_memory as exports.
|
||||
5 files changed, 34 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
|
||||
index ca3561d..52e7276 100644
|
||||
index 38422ae..be5dd63 100644
|
||||
--- a/dlls/ntdll/ntdll.spec
|
||||
+++ b/dlls/ntdll/ntdll.spec
|
||||
@@ -1463,6 +1463,10 @@
|
||||
@@ -1467,6 +1467,10 @@
|
||||
# signal handling
|
||||
@ cdecl __wine_set_signal_handler(long ptr)
|
||||
|
||||
@ -75,10 +75,10 @@ index 5c3aa819..cf20483 100644
|
||||
{
|
||||
context->Ecx = stack[0];
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 020a6c0..eb8893b 100644
|
||||
index 4d4bc3b..948a790 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -1642,13 +1642,14 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
|
||||
@@ -1628,13 +1628,14 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@ -95,8 +95,8 @@ index 020a6c0..eb8893b 100644
|
||||
+SIZE_T CDECL wine_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size )
|
||||
{
|
||||
struct file_view *view;
|
||||
SIZE_T bytes_read = 0;
|
||||
@@ -1666,10 +1667,14 @@ SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T
|
||||
sigset_t sigset;
|
||||
@@ -1653,10 +1654,14 @@ SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T
|
||||
while (bytes_read < size && (VIRTUAL_GetUnixProt( *p++ ) & PROT_READ))
|
||||
{
|
||||
SIZE_T block_size = min( size, page_size - ((UINT_PTR)addr & page_mask) );
|
||||
@ -114,7 +114,7 @@ index 020a6c0..eb8893b 100644
|
||||
bytes_read += block_size;
|
||||
}
|
||||
}
|
||||
@@ -1680,13 +1685,14 @@ SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T
|
||||
@@ -1667,13 +1672,14 @@ SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@ -131,8 +131,8 @@ index 020a6c0..eb8893b 100644
|
||||
+SIZE_T CDECL wine_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size )
|
||||
{
|
||||
struct file_view *view;
|
||||
SIZE_T bytes_written = 0;
|
||||
@@ -1723,10 +1729,14 @@ SIZE_T virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_
|
||||
sigset_t sigset;
|
||||
@@ -1711,10 +1717,14 @@ SIZE_T virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_
|
||||
}
|
||||
|
||||
block_size = min( size, page_size - ((UINT_PTR)addr & page_mask) );
|
||||
@ -151,10 +151,10 @@ index 020a6c0..eb8893b 100644
|
||||
}
|
||||
}
|
||||
diff --git a/include/winternl.h b/include/winternl.h
|
||||
index 2b10f8d..bd7ba4e 100644
|
||||
index 5420391..b039dd1 100644
|
||||
--- a/include/winternl.h
|
||||
+++ b/include/winternl.h
|
||||
@@ -2660,6 +2660,9 @@ NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW,
|
||||
@@ -2680,6 +2680,9 @@ NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW,
|
||||
UINT disposition, BOOLEAN check_case );
|
||||
NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt );
|
||||
|
||||
@ -165,5 +165,5 @@ index 2b10f8d..bd7ba4e 100644
|
||||
/***********************************************************************
|
||||
* Inline functions
|
||||
--
|
||||
2.5.1
|
||||
2.6.1
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
Fixes: Avoid race-conditions of async WSARecv() operations with write watches.
|
||||
Fixes: Avoid race-conditions with write watches in WS2_async_accept.
|
||||
Fixes: Basic handling of write watches triggered while we're on the signal stack.
|
||||
Depends: ntdll-Virtual_Memory_Stack
|
||||
Category: stable
|
||||
|
Loading…
Reference in New Issue
Block a user