Rebase against c82c5e96a9eb13bfa1fef95fb7467ce17624a341.

This commit is contained in:
Alistair Leslie-Hughes 2021-06-18 11:13:24 +10:00
parent 876024f44f
commit 5d26dfaa93
6 changed files with 39 additions and 44 deletions

View File

@ -1,4 +1,4 @@
From 339c0672e50344eabb605e13f3c58f7f534417dc Mon Sep 17 00:00:00 2001
From 414a6313d1562ce78fd2700d5ee1aeac14e87868 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 9 Jan 2020 13:44:01 -0600
Subject: [PATCH] ntdll/tests: Move some tests to a new sync.c file.
@ -24,7 +24,7 @@ index ed15c51339f..9a99c01bd7c 100644
time.c \
virtual.c
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 7d9ca47be12..d06812a9529 100644
index 82f8188d176..9a9536f4639 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -30,10 +30,6 @@
@ -586,7 +586,7 @@ index 7d9ca47be12..d06812a9529 100644
- status = pRtlWaitOnAddress(&address, &compare, 8, &timeout);
- ticks = GetTickCount() - ticks;
- ok(status == STATUS_TIMEOUT, "got 0x%08x\n", status);
- ok(ticks >= 90 && ticks <= 1000, "got %u\n", ticks);
- ok(ticks >= 80 && ticks <= 1000, "got %u\n", ticks);
- ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
- ok(compare == 0, "got %s\n", wine_dbgstr_longlong(compare));
-
@ -601,7 +601,7 @@ index 7d9ca47be12..d06812a9529 100644
- status = pRtlWaitOnAddress(&address, &compare, size, &timeout);
- ticks = GetTickCount() - ticks;
- ok(status == STATUS_TIMEOUT, "got 0x%08x\n", status);
- ok(ticks >= 90 && ticks <= 1000, "got %u\n", ticks);
- ok(ticks >= 80 && ticks <= 1000, "got %u\n", ticks);
-
- status = pRtlWaitOnAddress(&address, &compare, size << 1, &timeout);
- ok(!status, "got 0x%08x\n", status);

View File

@ -1,4 +1,4 @@
From 63701e8ab8c1a1dfa2faa34e0ee1e83cbc4880f2 Mon Sep 17 00:00:00 2001
From 4b4d65ecd081ff464821625bedc77aaf532d23c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 4 Oct 2014 02:53:22 +0200
Subject: [PATCH] ntdll: Setup a temporary signal handler during process
@ -15,10 +15,10 @@ Subject: [PATCH] ntdll: Setup a temporary signal handler during process
7 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 8ae2b4f8470..07829faf8c9 100644
index 6c8f3a4996d..5d35b68476b 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -2214,6 +2214,8 @@ void __wine_main( int argc, char *argv[], char *envp[] )
@@ -2212,6 +2212,8 @@ void __wine_main( int argc, char *argv[], char *envp[] )
#endif
virtual_init();
@ -62,10 +62,10 @@ index 669e44aaa2b..aba9c8dcf02 100644
/***********************************************************************
* init_thread_context
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 89f4fb4151c..a30ff779482 100644
index d04935bb1b2..cb6f48b73dc 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -1753,6 +1753,30 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr,
@@ -1781,6 +1781,30 @@ static BOOL handle_syscall_trap( ucontext_t *sigcontext )
}
@ -96,7 +96,7 @@ index 89f4fb4151c..a30ff779482 100644
/**********************************************************************
* segv_handler
*
@@ -2338,6 +2362,34 @@ void signal_init_process(void)
@@ -2368,6 +2392,34 @@ void signal_init_process(void)
exit(1);
}
@ -132,10 +132,10 @@ index 89f4fb4151c..a30ff779482 100644
/***********************************************************************
* init_thread_context
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 10aa2a516b0..55c9c322e75 100644
index c36699589d9..6a5f50c7c55 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -2599,6 +2599,12 @@ void signal_init_process(void)
@@ -2630,6 +2630,12 @@ void signal_init_process(void)
exit(1);
}
@ -149,10 +149,10 @@ index 10aa2a516b0..55c9c322e75 100644
/***********************************************************************
* init_thread_context
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 2efd107fff8..b64fa142aca 100644
index d3d303397fb..6064082f1a8 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -246,6 +246,7 @@ extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN;
@@ -237,6 +237,7 @@ extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_free_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_init_process(void) DECLSPEC_HIDDEN;
@ -161,18 +161,18 @@ index 2efd107fff8..b64fa142aca 100644
BOOL suspend, void *thunk, TEB *teb ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int), TEB *teb ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 2885cbbaa45..a4deac77a4c 100644
index 49dd3aa51e2..35a9b43d577 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -3264,7 +3264,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
@@ -3275,7 +3275,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
mutex_lock( &virtual_mutex ); /* no need for signal masking inside signal handler */
vprot = get_page_vprot( page );
- if (!is_inside_signal_stack( stack ) && (vprot & VPROT_GUARD))
+ if (stack && !is_inside_signal_stack( stack ) && (vprot & VPROT_GUARD))
{
if (page < (char *)NtCurrentTeb()->DeallocationStack ||
page >= (char *)NtCurrentTeb()->Tib.StackBase)
struct thread_stack_info stack_info;
if (!is_inside_thread_stack( page, &stack_info ))
--
2.30.2

View File

@ -1,4 +1,4 @@
From 6af98b9092396f69ac66c4659581436d9c6c7183 Mon Sep 17 00:00:00 2001
From d528d994e0bd5c51c24c30c674bcce118d09bf4a Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 24 Apr 2020 14:55:14 -0500
Subject: [PATCH] ntdll: Track if a WRITECOPY page has been modified.
@ -8,14 +8,14 @@ read-write page.
Signed-off-by: Andrew Wesie <awesie@gmail.com>
---
dlls/ntdll/unix/virtual.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
dlls/ntdll/unix/virtual.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index f3d7c24515f..045d10d92be 100644
index b75df0a05c0..f31613911fd 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -101,6 +101,7 @@ struct file_view
@@ -141,6 +141,7 @@ struct file_view
#define VPROT_GUARD 0x10
#define VPROT_COMMITTED 0x20
#define VPROT_WRITEWATCH 0x40
@ -23,7 +23,7 @@ index f3d7c24515f..045d10d92be 100644
/* per-mapping protection flags */
#define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */
#define VPROT_NATIVE 0x0400
@@ -871,7 +872,7 @@ static int get_unix_prot( BYTE vprot )
@@ -1029,7 +1030,7 @@ static int get_unix_prot( BYTE vprot )
#if defined(__i386__)
if (vprot & VPROT_WRITECOPY)
{
@ -32,7 +32,7 @@ index f3d7c24515f..045d10d92be 100644
prot = (prot & ~PROT_WRITE) | PROT_READ;
else
prot |= PROT_WRITE | PROT_READ;
@@ -1315,7 +1316,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
@@ -1466,7 +1467,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
*/
static DWORD get_win32_prot( BYTE vprot, unsigned int map_prot )
{
@ -45,7 +45,7 @@ index f3d7c24515f..045d10d92be 100644
if (vprot & VPROT_GUARD) ret |= PAGE_GUARD;
if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE;
return ret;
@@ -1426,7 +1431,7 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
@@ -1577,12 +1582,21 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
if (view->protect & VPROT_WRITEWATCH)
{
/* each page may need different protections depending on write watch flag */
@ -54,17 +54,12 @@ index f3d7c24515f..045d10d92be 100644
mprotect_range( base, size, 0, 0 );
return TRUE;
}
@@ -1442,10 +1447,18 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
return TRUE;
}
+
+ /* check that we can map this memory with PROT_WRITE since we cannot fail later */
+ if (vprot & VPROT_WRITECOPY)
+ unix_prot |= PROT_WRITE;
+
if (mprotect_exec( base, size, unix_prot )) /* FIXME: last error */
return FALSE;
if (mprotect_exec( base, size, unix_prot )) return FALSE;
- set_page_vprot( base, size, vprot );
+ /* each page may need different protections depending on writecopy */
+ set_page_vprot_bits( base, size, vprot, ~vprot & ~VPROT_WRITTEN );
@ -74,7 +69,7 @@ index f3d7c24515f..045d10d92be 100644
return TRUE;
}
@@ -3013,7 +3026,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
@@ -3321,7 +3335,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
}
if (vprot & VPROT_WRITECOPY)
{
@ -83,7 +78,7 @@ index f3d7c24515f..045d10d92be 100644
mprotect_range( page, page_size, 0, 0 );
}
/* ignore fault if page is writable now */
@@ -3955,7 +3968,7 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
@@ -4238,7 +4252,7 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
else if (view->protect & (SEC_FILE | SEC_RESERVE | SEC_COMMIT)) info->Type = MEM_MAPPED;
else info->Type = MEM_PRIVATE;
for (ptr = base; ptr < base + range_size; ptr += page_size)
@ -93,5 +88,5 @@ index f3d7c24515f..045d10d92be 100644
}
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
--
2.28.0
2.30.2

View File

@ -1,4 +1,4 @@
From 86b7f01ebe8d0cccd81a1d9913c9a42966ea7d3c Mon Sep 17 00:00:00 2001
From f26f4f9338473fee2ad3901fe5b259ac26e66f3c Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Tue, 28 Apr 2020 03:27:16 -0500
Subject: [PATCH] ntdll: Fallback to copy pages for WRITECOPY.
@ -16,10 +16,10 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 148da16f34d..1ca19a24003 100644
index 8346baf77a9..457468b47d9 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1447,8 +1447,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
@@ -1587,8 +1587,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
return TRUE;
}
@ -30,8 +30,8 @@ index 148da16f34d..1ca19a24003 100644
+ if ((vprot & VPROT_WRITECOPY) && (view->protect & VPROT_WRITECOPY))
unix_prot |= PROT_WRITE;
if (mprotect_exec( base, size, unix_prot )) /* FIXME: last error */
@@ -3026,10 +3027,26 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
if (mprotect_exec( base, size, unix_prot )) return FALSE;
@@ -3335,10 +3336,26 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH );
mprotect_range( page, page_size, 0, 0 );
}
@ -61,5 +61,5 @@ index 148da16f34d..1ca19a24003 100644
/* ignore fault if page is writable now */
if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS;
--
2.28.0
2.30.2

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "afd5550b07f6d55e56738f61d829085d6bc82888"
echo "c82c5e96a9eb13bfa1fef95fb7467ce17624a341"
}
# Show version information

View File

@ -1 +1 @@
afd5550b07f6d55e56738f61d829085d6bc82888
c82c5e96a9eb13bfa1fef95fb7467ce17624a341