Updated ntdll-WRITECOPY patchset.

Get the guard with STAGING_WRITECOPY env var back as the
patchset is currently causing some regressions.
This commit is contained in:
Paul Gofman 2020-05-08 19:05:09 +03:00
parent 813de5d6f8
commit 3931c93628
11 changed files with 75 additions and 131 deletions

View File

@ -1,4 +1,4 @@
From c8d7fd292e7eea515960d84adf8a62220e42cc90 Mon Sep 17 00:00:00 2001
From de02412f5e105f162e2e457d5bec698575fffc10 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 4 Oct 2014 02:35:44 +0200
Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer
@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index f896f53fdd7..e07df224fc6 100644
index 381062cceb1..e7c6ca63fe2 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1552,7 +1552,6 @@ todo_wine
@@ -1557,7 +1557,6 @@ todo_wine
"failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err);
todo_wine
ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen);
@ -22,10 +22,10 @@ index f896f53fdd7..e07df224fc6 100644
"Access and/or AccessStatus were changed!\n");
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 4db54c0788d..62e34e75b97 100644
index 046cf601ebf..3d88b47a744 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -389,9 +389,18 @@ unsigned int server_call_unlocked( void *req_ptr )
@@ -406,9 +406,18 @@ unsigned int server_call_unlocked( void *req_ptr )
*/
unsigned int CDECL wine_server_call( void *req_ptr )
{
@ -45,5 +45,5 @@ index 4db54c0788d..62e34e75b97 100644
ret = server_call_unlocked( req_ptr );
pthread_sigmask( SIG_SETMASK, &old_set, NULL );
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From 0290a4841fc26c0de72292f9e471b7bd636c42ed Mon Sep 17 00:00:00 2001
From a990f9a314c7e88ac23488c9cd3f0ca12e5ae34b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 4 Oct 2014 02:38:27 +0200
Subject: [PATCH] advapi: Trigger write watches before passing userdata pointer
@ -23,5 +23,5 @@ index 7199795b475..4cd436d7925 100644
close(dev_random);
return TRUE;
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From 1c3f679ce2419438e8a768bb5ed1728843a9f05c Mon Sep 17 00:00:00 2001
From 3ecd352d441ac2d596508cd693431abdd7128ec6 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, 79 insertions(+)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 27845ac7f51..e75e5de0954 100644
index 58b688d06bd..f3ebfb72d32 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -82,6 +82,7 @@ extern NTSTATUS signal_alloc_thread( TEB **teb ) DECLSPEC_HIDDEN;
@@ -84,6 +84,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;
@ -27,10 +27,10 @@ index 27845ac7f51..e75e5de0954 100644
extern void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c
index 63c008224df..46c8d5eb25f 100644
index 31280edce47..f903eb93434 100644
--- a/dlls/ntdll/signal_arm.c
+++ b/dlls/ntdll/signal_arm.c
@@ -1053,6 +1053,12 @@ void signal_init_process(void)
@@ -1031,6 +1031,12 @@ void signal_init_process(void)
exit(1);
}
@ -44,10 +44,10 @@ index 63c008224df..46c8d5eb25f 100644
/***********************************************************************
* RtlUnwind (NTDLL.@)
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 15e78dbb562..0d8d1697722 100644
index 9f84d3fbfd1..8ab83a1d142 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -1306,6 +1306,12 @@ void signal_init_thread( TEB *teb )
@@ -1293,6 +1293,12 @@ void signal_init_thread( TEB *teb )
pthread_setspecific( teb_key, teb );
}
@ -61,10 +61,10 @@ index 15e78dbb562..0d8d1697722 100644
/**********************************************************************
* signal_init_process
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index fd1a764dacf..c4ef7ac7ef6 100644
index 238d4eacf63..32c6eba0e51 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2062,6 +2062,31 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st
@@ -2051,6 +2051,31 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st
}
@ -96,7 +96,7 @@ index fd1a764dacf..c4ef7ac7ef6 100644
/**********************************************************************
* segv_handler
*
@@ -2757,6 +2782,34 @@ void signal_init_process(void)
@@ -2689,6 +2714,34 @@ void signal_init_process(void)
exit(1);
}
@ -132,10 +132,10 @@ index fd1a764dacf..c4ef7ac7ef6 100644
/*******************************************************************
* RtlUnwind (NTDLL.@)
diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c
index ee765e226b1..632fffc187b 100644
index 9df6eff31f4..e79fca3abce 100644
--- a/dlls/ntdll/signal_powerpc.c
+++ b/dlls/ntdll/signal_powerpc.c
@@ -1068,6 +1068,12 @@ void signal_init_thread( TEB *teb )
@@ -1047,6 +1047,12 @@ void signal_init_thread( TEB *teb )
pthread_setspecific( teb_key, teb );
}
@ -149,10 +149,10 @@ index ee765e226b1..632fffc187b 100644
/**********************************************************************
* signal_init_process
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 6c2f34b54ca..4c26a8b52b4 100644
index 324a92b41a9..29829bfb1c6 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3414,6 +3414,12 @@ void signal_init_process(void)
@@ -3286,6 +3286,12 @@ void signal_init_process(void)
exit(1);
}
@ -166,10 +166,10 @@ index 6c2f34b54ca..4c26a8b52b4 100644
static ULONG64 get_int_reg( CONTEXT *context, int reg )
{
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 744dc030d9c..393b99b6e61 100644
index 125280ba257..af6861f6000 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -285,6 +285,7 @@ TEB *thread_init(void)
@@ -284,6 +284,7 @@ TEB *thread_init(void)
struct ntdll_thread_data *thread_data;
virtual_init();
@ -178,5 +178,5 @@ index 744dc030d9c..393b99b6e61 100644
/* reserve space for shared user data */
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From b304bfba257073741c03dbcb719f55d2788c18a3 Mon Sep 17 00:00:00 2001
From 8c8e2422bea9485bdcda98cea703983bb01f6e41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 4 Oct 2014 03:22:09 +0200
Subject: [PATCH] ntdll: Properly handle PAGE_WRITECOPY protection. (try 5)
@ -9,7 +9,7 @@ For now, only enable it when a special environment variable is set.
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 7700385eb7b..aec6c18da87 100644
index 328bc40a92f..3533a087d88 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -321,6 +321,21 @@ static const char *VIRTUAL_GetProtStr( BYTE prot )
@ -64,7 +64,7 @@ index 7700385eb7b..aec6c18da87 100644
/* restore page protections on the entire range */
mprotect_range( base, size, 0, 0 );
}
@@ -2336,12 +2362,13 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2340,12 +2366,13 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH );
mprotect_range( page, page_size, 0, 0 );
}
@ -82,7 +82,7 @@ index 7700385eb7b..aec6c18da87 100644
}
server_leave_uninterrupted_section( &csVirtual, &sigset );
return ret;
@@ -2363,11 +2390,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
@@ -2367,11 +2394,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
{
BYTE vprot = get_page_vprot( addr + i );
if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE;

View File

@ -1,4 +1,4 @@
From 7656f468a405a0b399994f0cbb9bd8388100cfde Mon Sep 17 00:00:00 2001
From c38118527458007162f8cbe38bec0dd02b9de6e7 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.
@ -12,10 +12,10 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index fa39a67b9ca..b5baa4c6242 100644
index 3533a087d88..75219ae2376 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -84,6 +84,7 @@ struct file_view
@@ -85,6 +85,7 @@ struct file_view
#define VPROT_GUARD 0x10
#define VPROT_COMMITTED 0x20
#define VPROT_WRITEWATCH 0x40
@ -23,7 +23,7 @@ index fa39a67b9ca..b5baa4c6242 100644
/* per-mapping protection flags */
#define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */
@@ -355,7 +356,7 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
@@ -353,7 +354,7 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
#if defined(__i386__)
if (vprot & VPROT_WRITECOPY)
{
@ -32,7 +32,7 @@ index fa39a67b9ca..b5baa4c6242 100644
prot = (prot & ~PROT_WRITE) | PROT_READ;
else
prot |= PROT_WRITE | PROT_READ;
@@ -918,7 +919,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
@@ -925,7 +926,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
*/
static DWORD VIRTUAL_GetWin32Prot( BYTE vprot, unsigned int map_prot )
{
@ -45,7 +45,7 @@ index fa39a67b9ca..b5baa4c6242 100644
if (vprot & VPROT_GUARD) ret |= PAGE_GUARD;
if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE;
return ret;
@@ -1042,7 +1047,7 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
@@ -1049,7 +1054,7 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
if (view->protect & VPROT_WRITEWATCH)
{
/* each page may need different protections depending on write watch flag */
@ -54,7 +54,7 @@ index fa39a67b9ca..b5baa4c6242 100644
mprotect_range( base, size, 0, 0 );
return TRUE;
}
@@ -1058,10 +1063,18 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
@@ -1065,10 +1070,18 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
return TRUE;
}
@ -74,7 +74,7 @@ index fa39a67b9ca..b5baa4c6242 100644
return TRUE;
}
@@ -2319,7 +2332,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2368,7 +2381,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
}
if (vprot & VPROT_WRITECOPY)
{
@ -83,7 +83,7 @@ index fa39a67b9ca..b5baa4c6242 100644
mprotect_range( page, page_size, 0, 0 );
}
/* ignore fault if page is writable now */
@@ -3265,7 +3278,7 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
@@ -3272,7 +3285,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 +93,5 @@ index fa39a67b9ca..b5baa4c6242 100644
}
server_leave_uninterrupted_section( &csVirtual, &sigset );
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From 75e8a937fbcf1a4ebb78ab29e42ecf13e8cede8b Mon Sep 17 00:00:00 2001
From d92ad57aa5a51f41f1d01d39e8585e4398770893 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 24 Apr 2020 14:55:15 -0500
Subject: [PATCH] ntdll: Support WRITECOPY on x64.
@ -10,10 +10,10 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 4c26a8b52b4..95a0a1ad0ac 100644
index 29829bfb1c6..89a8e36410d 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -2881,6 +2881,29 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, struct stack_layout
@@ -2871,6 +2871,29 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, struct stack_layout
}
@ -43,7 +43,7 @@ index 4c26a8b52b4..95a0a1ad0ac 100644
/**********************************************************************
* segv_handler
*
@@ -3419,6 +3442,23 @@ void signal_init_process(void)
@@ -3291,6 +3314,23 @@ void signal_init_process(void)
*/
void signal_init_early(void)
{
@ -68,10 +68,10 @@ index 4c26a8b52b4..95a0a1ad0ac 100644
static ULONG64 get_int_reg( CONTEXT *context, int reg )
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index b5baa4c6242..d255ed86f75 100644
index 75219ae2376..df77f55a9e7 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -353,7 +353,7 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
@@ -351,7 +351,7 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
if (vprot & VPROT_READ) prot |= PROT_READ;
if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ;
if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ;
@ -81,5 +81,5 @@ index b5baa4c6242..d255ed86f75 100644
{
if (experimental_WRITECOPY() && !(vprot & VPROT_WRITTEN))
--
2.25.4
2.26.2

View File

@ -1,54 +0,0 @@
From 255c6b90685e1fe6eaa7b3a2eec2730c6d0f47a6 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 24 Apr 2020 14:55:16 -0500
Subject: [PATCH] ntdll: Always enable WRITECOPY support.
Signed-off-by: Andrew Wesie <awesie@gmail.com>
---
dlls/ntdll/virtual.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index d255ed86f75..da71d02bbcc 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -324,22 +324,6 @@ static const char *VIRTUAL_GetProtStr( BYTE prot )
return buffer;
}
-/* This might look like a hack, but it actually isn't - the 'experimental' version
- * is correct, but it already has revealed a couple of additional Wine bugs, which
- * were not triggered before, and there are probably some more.
- * To avoid breaking Wine for everyone, the new correct implementation has to be
- * manually enabled, until it is tested a bit more. */
-static inline BOOL experimental_WRITECOPY( void )
-{
- static int enabled = -1;
- if (enabled == -1)
- {
- const char *str = getenv("STAGING_WRITECOPY");
- enabled = str && (atoi(str) != 0);
- }
- return enabled;
-}
-
/***********************************************************************
* VIRTUAL_GetUnixProt
*
@@ -356,10 +340,10 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
#if defined(__i386__) || defined(__x86_64__)
if (vprot & VPROT_WRITECOPY)
{
- if (experimental_WRITECOPY() && !(vprot & VPROT_WRITTEN))
- prot = (prot & ~PROT_WRITE) | PROT_READ;
- else
+ if (vprot & VPROT_WRITTEN)
prot |= PROT_WRITE | PROT_READ;
+ else
+ prot = (prot & ~PROT_WRITE) | PROT_READ;
}
#else
/* FIXME: Architecture needs implementation of signal_init_early. */
--
2.25.4

View File

@ -1,4 +1,4 @@
From 5616938e388833d8c171123508a9fc59c5d27b0e Mon Sep 17 00:00:00 2001
From b2ce2a421031982e0e0923d84bdbe767b14747b9 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 24 Apr 2020 14:55:17 -0500
Subject: [PATCH] ntdll: Report unmodified WRITECOPY pages as shared.
@ -13,10 +13,10 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index da71d02bbcc..8d34b9a1e53 100644
index df77f55a9e7..b329a9024d8 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1775,6 +1775,8 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, int top_
@@ -1737,6 +1737,8 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, int top_
ptr + sec->VirtualAddress + file_size,
ptr + sec->VirtualAddress + end );
memset( ptr + sec->VirtualAddress + file_size, 0, end - file_size );
@ -25,7 +25,7 @@ index da71d02bbcc..8d34b9a1e53 100644
}
}
@@ -3313,7 +3315,7 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr,
@@ -3336,7 +3338,7 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr,
(vprot & VPROT_COMMITTED))
{
p->VirtualAttributes.Valid = !(vprot & VPROT_GUARD) && (vprot & 0x0f) && (pagemap >> 63);
@ -35,5 +35,5 @@ index da71d02bbcc..8d34b9a1e53 100644
p->VirtualAttributes.ShareCount = 1; /* FIXME */
if (p->VirtualAttributes.Valid)
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From c866be89ef18bdf0757e4ee03b68943ec85dceed Mon Sep 17 00:00:00 2001
From e7d46415e6361015c969027ade253a03e620cd66 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/virtual.c b/dlls/ntdll/virtual.c
index 8d34b9a1e53..bde8a475c97 100644
index b329a9024d8..e68ca274ca4 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1047,8 +1047,9 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
@@ -1070,8 +1070,9 @@ static BOOL VIRTUAL_SetProt( struct file_view *view, /* [in] Pointer to view */
return TRUE;
}
@ -31,7 +31,7 @@ index 8d34b9a1e53..bde8a475c97 100644
unix_prot |= PROT_WRITE;
if (mprotect_exec( base, size, unix_prot )) /* FIXME: last error */
@@ -2316,10 +2317,26 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2381,10 +2382,26 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH );
mprotect_range( page, page_size, 0, 0 );
}
@ -61,5 +61,5 @@ index 8d34b9a1e53..bde8a475c97 100644
/* ignore fault if page is writable now */
if (VIRTUAL_GetUnixProt( get_page_vprot( page )) & PROT_WRITE) ret = STATUS_SUCCESS;
--
2.25.4
2.26.2

View File

@ -1,4 +1,4 @@
From 8cfae1d0d5b68675169704db7d752801a3a83d09 Mon Sep 17 00:00:00 2001
From dacc9e9e6a5759cfd00ac9653a08ac78e604f243 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Mon, 27 Apr 2020 15:32:22 +0300
Subject: [PATCH] kernel32/tests, psapi/tests: Update tests.
@ -9,10 +9,10 @@ Subject: [PATCH] kernel32/tests, psapi/tests: Update tests.
2 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 2b7c8c6ef87..0852fe36d18 100644
index f576d132d8b..70824d771ed 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -3589,9 +3589,7 @@ static void test_CreateFileMapping_protection(void)
@@ -3572,9 +3572,7 @@ static void test_CreateFileMapping_protection(void)
SetLastError(0xdeadbeef);
ret = VirtualQuery(base, &info, sizeof(info));
ok(ret, "VirtualQuery failed %d\n", GetLastError());
@ -23,7 +23,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
}
}
else
@@ -3605,9 +3603,7 @@ static void test_CreateFileMapping_protection(void)
@@ -3588,9 +3586,7 @@ static void test_CreateFileMapping_protection(void)
SetLastError(0xdeadbeef);
ret = VirtualProtect(base, si.dwPageSize, PAGE_NOACCESS, &old_prot);
ok(ret, "%d: VirtualProtect error %d\n", i, GetLastError());
@ -34,7 +34,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
UnmapViewOfFile(base);
}
@@ -3960,15 +3956,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
@@ -3943,15 +3939,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
continue;
}
@ -50,7 +50,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
ok(info.Protect == actual_prot,
"VirtualProtect wrong prot, map %#x, view %#x, requested prot %#x got %#x\n",
page_prot[i], view[j].prot, page_prot[k], info.Protect );
@@ -4023,15 +4016,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
@@ -4006,15 +3999,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
if (!anon_mapping && is_compatible_protection(alloc_prot, PAGE_WRITECOPY))
{
ret = VirtualProtect(base, sec_flags & SEC_IMAGE ? si.dwPageSize : 2*si.dwPageSize, PAGE_WRITECOPY, &old_prot);
@ -66,7 +66,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
ok(info.RegionSize == si.dwPageSize, "wrong region size %#lx after write, map %#x, view %#x got %#x\n",
info.RegionSize, page_prot[i], view[j].prot, info.Protect );
@@ -4042,7 +4032,6 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
@@ -4025,7 +4015,6 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
{
ret = VirtualQuery((char*)base + si.dwPageSize, &info, sizeof(info));
ok(ret, "%d: VirtualQuery failed %d\n", j, GetLastError());
@ -74,7 +74,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
ok(info.Protect == PAGE_WRITECOPY, "wrong prot, map %#x, view %#x got %#x\n",
page_prot[i], view[j].prot, info.Protect);
}
@@ -4062,14 +4051,11 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
@@ -4045,14 +4034,11 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
continue;
}
@ -89,7 +89,7 @@ index 2b7c8c6ef87..0852fe36d18 100644
ok(info.Protect == map_prot_written( page_prot[k] ),
"VirtualProtect wrong prot, map %#x, view %#x, requested prot %#x got %#x\n",
page_prot[i], view[j].prot, page_prot[k], info.Protect );
@@ -4110,7 +4096,6 @@ static void test_mappings(void)
@@ -4093,7 +4079,6 @@ static void test_mappings(void)
SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
ok(ReadFile(hfile, &data, sizeof(data), &num_bytes, NULL), "ReadFile failed\n");
ok(num_bytes == sizeof(data), "num_bytes = %d\n", num_bytes);
@ -98,10 +98,10 @@ index 2b7c8c6ef87..0852fe36d18 100644
CloseHandle( hfile );
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index d3714a654ec..3984805d2b9 100644
index da7524dd60a..eb52fc690cf 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -798,7 +798,7 @@ free_page:
@@ -791,7 +791,7 @@ free_page:
}
static void check_QueryWorkingSetEx(PVOID addr, const char *desc, DWORD expected_valid,
@ -110,7 +110,7 @@ index d3714a654ec..3984805d2b9 100644
{
PSAPI_WORKING_SET_EX_INFORMATION info;
BOOL ret;
@@ -821,7 +821,6 @@ static void check_QueryWorkingSetEx(PVOID addr, const char *desc, DWORD expected
@@ -814,7 +814,6 @@ static void check_QueryWorkingSetEx(PVOID addr, const char *desc, DWORD expected
ok(info.VirtualAttributes.LargePage == 0, "%s expected LargePage=0 but got %u\n",
desc, info.VirtualAttributes.LargePage);
@ -118,7 +118,7 @@ index d3714a654ec..3984805d2b9 100644
ok(info.VirtualAttributes.Shared == expected_shared || broken(!info.VirtualAttributes.Valid) /* w2003 */,
"%s expected Shared=%u but got %u\n", desc, expected_shared, info.VirtualAttributes.Shared);
if (info.VirtualAttributes.Valid && info.VirtualAttributes.Shared)
@@ -838,6 +837,8 @@ static void test_QueryWorkingSetEx(void)
@@ -831,6 +830,8 @@ static void test_QueryWorkingSetEx(void)
DWORD prot;
BOOL ret;
@ -127,7 +127,7 @@ index d3714a654ec..3984805d2b9 100644
if (pQueryWorkingSetEx == NULL)
{
win_skip("QueryWorkingSetEx not found, skipping tests\n");
@@ -845,44 +846,55 @@ static void test_QueryWorkingSetEx(void)
@@ -838,44 +839,55 @@ static void test_QueryWorkingSetEx(void)
}
addr = GetModuleHandleA(NULL);
@ -195,5 +195,5 @@ index d3714a654ec..3984805d2b9 100644
START_TEST(psapi_main)
--
2.25.4
2.26.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "148fc1adb53aa1d78a67b2a0ee5ea8058d92589a"
echo "a897d858e4671e10e64ebf0bc3c0df6cb35944fd"
}
# Show version information
@ -4364,10 +4364,9 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then
patch_apply ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch
patch_apply ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch
patch_apply ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch
patch_apply ntdll-WRITECOPY/0007-ntdll-Always-enable-WRITECOPY-support.patch
patch_apply ntdll-WRITECOPY/0008-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch
patch_apply ntdll-WRITECOPY/0009-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch
patch_apply ntdll-WRITECOPY/0010-kernel32-tests-psapi-tests-Update-tests.patch
patch_apply ntdll-WRITECOPY/0007-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch
patch_apply ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch
patch_apply ntdll-WRITECOPY/0009-kernel32-tests-psapi-tests-Update-tests.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Trigger write watches before passing userdata pointer to wait_reply.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "advapi: Trigger write watches before passing userdata pointer to read syscall.", 1 },';
@ -4375,7 +4374,6 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then
printf '%s\n' '+ { "Michael Müller", "ntdll: Properly handle PAGE_WRITECOPY protection.", 5 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Track if a WRITECOPY page has been modified.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Support WRITECOPY on x64.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Always enable WRITECOPY support.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Report unmodified WRITECOPY pages as shared.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Fallback to copy pages for WRITECOPY.", 1 },';
printf '%s\n' '+ { "Andrew Wesie", "kernel32/tests, psapi/tests: Update tests.", 1 },';