From 26d3815d8c0744a7cdd89370b0c78be5311d0df5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 20 Jul 2020 20:07:57 +0300 Subject: [PATCH] Updated ntdll-WRITECOPY patchset. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49577 --- ...ite-watches-before-passing-userdata-.patch | 10 ++-- ...rite-watches-before-passing-userdata.patch | 6 +-- ...mporary-signal-handler-during-proces.patch | 48 +++++++++++-------- ...andle-PAGE_WRITECOPY-protection.-try.patch | 6 +-- ...f-a-WRITECOPY-page-has-been-modified.patch | 18 +++---- .../0006-ntdll-Support-WRITECOPY-on-x64.patch | 19 ++++---- ...unmodified-WRITECOPY-pages-as-shared.patch | 10 ++-- ...Fallback-to-copy-pages-for-WRITECOPY.patch | 10 ++-- ...nel32-tests-psapi-tests-Update-tests.patch | 8 ++-- 9 files changed, 73 insertions(+), 62 deletions(-) diff --git a/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch b/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch index 53b9152b..703f6334 100644 --- a/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch +++ b/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch @@ -1,4 +1,4 @@ -From 78a7689c0360fbf9ab6e494cc7113da5f73510fe Mon Sep 17 00:00:00 2001 +From 967a59e4a02f5aa9a607e52b3cbc91a0d268c064 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 4 Oct 2014 02:35:44 +0200 Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer @@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index 825f8451904..b414401634a 100644 +index ab572421a735..01f7a8783b18 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -1557,7 +1557,6 @@ todo_wine @@ -22,10 +22,10 @@ index 825f8451904..b414401634a 100644 "Access and/or AccessStatus were changed!\n"); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index 17b23e58d28..91155a1663d 100644 +index 452094ff5dc0..3c0d29a00624 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c -@@ -304,9 +304,17 @@ unsigned int server_call_unlocked( void *req_ptr ) +@@ -282,9 +282,17 @@ unsigned int server_call_unlocked( void *req_ptr ) */ unsigned int CDECL wine_server_call( void *req_ptr ) { @@ -44,5 +44,5 @@ index 17b23e58d28..91155a1663d 100644 ret = server_call_unlocked( req_ptr ); pthread_sigmask( SIG_SETMASK, &old_set, NULL ); -- -2.26.2 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0002-advapi-Trigger-write-watches-before-passing-userdata.patch b/patches/ntdll-WRITECOPY/0002-advapi-Trigger-write-watches-before-passing-userdata.patch index 9e5d7f3f..936e90ad 100644 --- a/patches/ntdll-WRITECOPY/0002-advapi-Trigger-write-watches-before-passing-userdata.patch +++ b/patches/ntdll-WRITECOPY/0002-advapi-Trigger-write-watches-before-passing-userdata.patch @@ -1,4 +1,4 @@ -From a990f9a314c7e88ac23488c9cd3f0ca12e5ae34b Mon Sep 17 00:00:00 2001 +From 1b6f10a6952b56b5626760c01587f96df0ab16db Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 4 Oct 2014 02:38:27 +0200 Subject: [PATCH] advapi: Trigger write watches before passing userdata pointer @@ -9,7 +9,7 @@ Subject: [PATCH] advapi: Trigger write watches before passing userdata pointer 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c -index 7199795b475..4cd436d7925 100644 +index 7199795b4759..4cd436d79259 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -2443,7 +2443,8 @@ BOOLEAN WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen) @@ -23,5 +23,5 @@ index 7199795b475..4cd436d7925 100644 close(dev_random); return TRUE; -- -2.26.2 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch index 348a9540..08867675 100644 --- a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch +++ b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch @@ -1,4 +1,4 @@ -From 25022d43f705d40658bb1aaf3ad8e86edf8b3325 Mon Sep 17 00:00:00 2001 +From 748433a959d7544dc7a2a9205fa75b2ee925d6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 4 Oct 2014 02:53:22 +0200 Subject: [PATCH] ntdll: Setup a temporary signal handler during process @@ -8,16 +8,17 @@ Subject: [PATCH] ntdll: Setup a temporary signal handler during process dlls/ntdll/unix/loader.c | 1 + dlls/ntdll/unix/signal_arm.c | 6 ++++ dlls/ntdll/unix/signal_arm64.c | 7 +++++ - dlls/ntdll/unix/signal_i386.c | 56 +++++++++++++++++++++++++++++++++ + dlls/ntdll/unix/signal_i386.c | 52 +++++++++++++++++++++++++++++++++ dlls/ntdll/unix/signal_x86_64.c | 6 ++++ dlls/ntdll/unix/unix_private.h | 1 + - 6 files changed, 77 insertions(+) + dlls/ntdll/unix/virtual.c | 2 +- + 7 files changed, 74 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index d03f5861d0..d7aa088e1d 100644 +index a343274087a7..d8422bc9fa33 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1812,6 +1812,7 @@ void __wine_main( int argc, char *argv[], char *envp[] ) +@@ -1703,6 +1703,7 @@ void __wine_main( int argc, char *argv[], char *envp[] ) #endif virtual_init(); @@ -26,7 +27,7 @@ index d03f5861d0..d7aa088e1d 100644 ntdll_module = load_ntdll(); fixup_ntdll_imports( &__wine_spec_nt_header ); diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c -index 34463309de..0810024a34 100644 +index 34463309def5..0810024a34bd 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -830,6 +830,12 @@ void signal_init_process(void) @@ -43,7 +44,7 @@ index 34463309de..0810024a34 100644 /*********************************************************************** * init_thread_context diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c -index e66952a29b..4b63de0ea4 100644 +index e66952a29b60..4b63de0ea456 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -882,6 +882,13 @@ void signal_init_process(void) @@ -61,10 +62,10 @@ index e66952a29b..4b63de0ea4 100644 * init_thread_context */ diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c -index 162a0b6a70..dc66ed0f38 100644 +index 162a0b6a7011..6e670923138d 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c -@@ -1590,6 +1590,34 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo +@@ -1590,6 +1590,30 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo } @@ -76,17 +77,13 @@ index 162a0b6a70..dc66ed0f38 100644 + */ +static void segv_handler_early( int signal, siginfo_t *siginfo, void *sigcontext ) +{ -+ EXCEPTION_RECORD rec = { 0 }; -+ CONTEXT context; + ucontext_t *ucontext = sigcontext; -+ void *stack = setup_exception_record( sigcontext, &rec, &context ); -+ -+ init_handler( sigcontext ); + + switch (TRAP_sig(ucontext)) + { + case TRAP_x86_PAGEFLT: /* Page fault */ -+ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, stack )) ++ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, ++ NULL)) + return; + /* fall-through */ + default: @@ -99,7 +96,7 @@ index 162a0b6a70..dc66ed0f38 100644 /********************************************************************** * segv_handler * -@@ -2148,6 +2176,34 @@ void signal_init_process(void) +@@ -2148,6 +2172,34 @@ void signal_init_process(void) exit(1); } @@ -135,7 +132,7 @@ index 162a0b6a70..dc66ed0f38 100644 /*********************************************************************** * init_thread_context diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c -index 01be0eab81..4342ab0237 100644 +index 01be0eab8146..4342ab023775 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2409,6 +2409,12 @@ void signal_init_process(void) @@ -152,7 +149,7 @@ index 01be0eab81..4342ab0237 100644 /*********************************************************************** * init_thread_context diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 3cf9ca6673..76c483cc3f 100644 +index 3cf9ca66736c..76c483cc3f50 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -218,6 +218,7 @@ extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN; @@ -163,6 +160,19 @@ index 3cf9ca6673..76c483cc3f 100644 extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg, BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN; +diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c +index b17d8d6b61e1..d4a8d4d38d5b 100644 +--- a/dlls/ntdll/unix/virtual.c ++++ b/dlls/ntdll/unix/virtual.c +@@ -2882,7 +2882,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) + + pthread_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) -- -2.27.0 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch b/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch index d58e5911..024b14bb 100644 --- a/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch +++ b/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch @@ -1,4 +1,4 @@ -From 7cdceba44d1eb2af5a724f55964802cd8bc05454 Mon Sep 17 00:00:00 2001 +From cf0cdffd0ddaeb7f72f447554247d257608ff53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= 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/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index b17d8d6b61e..d3ed89de62e 100644 +index d4a8d4d38d5b..f0ec65d12704 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -500,6 +500,21 @@ int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T si @@ -101,5 +101,5 @@ index b17d8d6b61e..d3ed89de62e 100644 } -- -2.27.0 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch index 43a37ee5..0998f0c5 100644 --- a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch +++ b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch @@ -1,4 +1,4 @@ -From f59e093e93d4ed55111489186ae73f8f3d7ee632 Mon Sep 17 00:00:00 2001 +From 065015c3bc777193f4d44ca7969995a9ec563ce2 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 24 Apr 2020 14:55:14 -0500 Subject: [PATCH] ntdll: Track if a WRITECOPY page has been modified. @@ -12,7 +12,7 @@ Signed-off-by: Andrew Wesie 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index b059261b3c0..0a6d7691575 100644 +index f0ec65d12704..98c5aad578c6 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -97,6 +97,7 @@ struct file_view @@ -23,7 +23,7 @@ index b059261b3c0..0a6d7691575 100644 /* per-mapping protection flags */ #define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */ -@@ -811,7 +812,7 @@ static int get_unix_prot( BYTE vprot ) +@@ -820,7 +821,7 @@ static int get_unix_prot( BYTE vprot ) #if defined(__i386__) if (vprot & VPROT_WRITECOPY) { @@ -32,7 +32,7 @@ index b059261b3c0..0a6d7691575 100644 prot = (prot & ~PROT_WRITE) | PROT_READ; else prot |= PROT_WRITE | PROT_READ; -@@ -1390,7 +1391,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz +@@ -1406,7 +1407,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 b059261b3c0..0a6d7691575 100644 if (vprot & VPROT_GUARD) ret |= PAGE_GUARD; if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE; return ret; -@@ -1501,7 +1506,7 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr +@@ -1517,7 +1522,7 @@ 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,7 +54,7 @@ index b059261b3c0..0a6d7691575 100644 mprotect_range( base, size, 0, 0 ); return TRUE; } -@@ -1517,10 +1522,18 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr +@@ -1533,10 +1538,18 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr return TRUE; } @@ -74,7 +74,7 @@ index b059261b3c0..0a6d7691575 100644 return TRUE; } -@@ -2882,7 +2895,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) +@@ -2928,7 +2941,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) } if (vprot & VPROT_WRITECOPY) { @@ -83,7 +83,7 @@ index b059261b3c0..0a6d7691575 100644 mprotect_range( page, page_size, 0, 0 ); } /* ignore fault if page is writable now */ -@@ -3812,7 +3825,7 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr, +@@ -3873,7 +3886,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 b059261b3c0..0a6d7691575 100644 } server_leave_uninterrupted_section( &virtual_mutex, &sigset ); -- -2.27.0 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch b/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch index 7c03bd33..dfd03137 100644 --- a/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch +++ b/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch @@ -1,19 +1,19 @@ -From 38e1b3603dc067d91621b63d157edc339d8a33d8 Mon Sep 17 00:00:00 2001 +From 3c08a3d54b19ceb7daff2e033be76115ea013cd9 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 24 Apr 2020 14:55:15 -0500 Subject: [PATCH] ntdll: Support WRITECOPY on x64. Signed-off-by: Andrew Wesie --- - dlls/ntdll/unix/signal_x86_64.c | 40 +++++++++++++++++++++++++++++++++ + dlls/ntdll/unix/signal_x86_64.c | 41 +++++++++++++++++++++++++++++++++ dlls/ntdll/unix/virtual.c | 2 +- - 2 files changed, 41 insertions(+), 1 deletion(-) + 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c -index 98bd7bb8bed..1d1b879310e 100644 +index 4342ab023775..4984d5bdad72 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c -@@ -1019,6 +1019,29 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, struct stack_layout +@@ -2040,6 +2040,30 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, EXCEPTION_RECORD *r } @@ -30,7 +30,8 @@ index 98bd7bb8bed..1d1b879310e 100644 + switch(TRAP_sig(ucontext)) + { + case TRAP_x86_PAGEFLT: /* Page fault */ -+ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, TRUE )) ++ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, ++ NULL )) + return; + /* fall-through */ + default: @@ -43,7 +44,7 @@ index 98bd7bb8bed..1d1b879310e 100644 /********************************************************************** * segv_handler * -@@ -1420,6 +1443,23 @@ void signal_init_process(void) +@@ -2414,6 +2438,23 @@ void signal_init_process(void) */ void signal_init_early(void) { @@ -68,7 +69,7 @@ index 98bd7bb8bed..1d1b879310e 100644 /*********************************************************************** diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index b20eafb3334..c351c7db0e3 100644 +index 98c5aad578c6..16cfa8bda2d7 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -818,7 +818,7 @@ static int get_unix_prot( BYTE vprot ) @@ -81,5 +82,5 @@ index b20eafb3334..c351c7db0e3 100644 { if (experimental_WRITECOPY() && !(vprot & VPROT_WRITTEN)) -- -2.26.2 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0007-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch b/patches/ntdll-WRITECOPY/0007-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch index 5805bf6b..be42d7d3 100644 --- a/patches/ntdll-WRITECOPY/0007-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch +++ b/patches/ntdll-WRITECOPY/0007-ntdll-Report-unmodified-WRITECOPY-pages-as-shared.patch @@ -1,4 +1,4 @@ -From 262cfe702345c97ebb32a651cef272fe74e98322 Mon Sep 17 00:00:00 2001 +From 961363c939e566a74b9343ad2e328b1f6fce7361 Mon Sep 17 00:00:00 2001 From: Andrew Wesie 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 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 1072907ffdd..9a576de4930 100644 +index 16cfa8bda2d7..8b3f93b70d41 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -2188,6 +2188,8 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, int top_ +@@ -2174,6 +2174,8 @@ static NTSTATUS map_image_into_view( struct file_view *view, int fd, void *orig_ ptr + sec->VirtualAddress + file_size, ptr + sec->VirtualAddress + end ); memset( ptr + sec->VirtualAddress + file_size, 0, end - file_size ); @@ -25,7 +25,7 @@ index 1072907ffdd..9a576de4930 100644 } } -@@ -3724,7 +3726,7 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr, +@@ -3937,7 +3939,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 1072907ffdd..9a576de4930 100644 p->VirtualAttributes.ShareCount = 1; /* FIXME */ if (p->VirtualAttributes.Valid) -- -2.26.2 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch b/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch index d620b2be..8bd52eed 100644 --- a/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch +++ b/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch @@ -1,4 +1,4 @@ -From 560a608432d8d4df920370e4bd50113c1db87b1f Mon Sep 17 00:00:00 2001 +From 5749f2c2ddcf9dc0dc5d1257b4829bd6bdda4c7e Mon Sep 17 00:00:00 2001 From: Andrew Wesie 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 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 9a576de4930..e824b9ced25 100644 +index 8b3f93b70d41..c53b87076075 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -1529,8 +1529,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr +@@ -1538,8 +1538,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr return TRUE; } @@ -31,7 +31,7 @@ index 9a576de4930..e824b9ced25 100644 unix_prot |= PROT_WRITE; if (mprotect_exec( base, size, unix_prot )) /* FIXME: last error */ -@@ -2787,10 +2788,26 @@ NTSTATUS CDECL virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_sta +@@ -2941,10 +2942,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 9a576de4930..e824b9ced25 100644 /* ignore fault if page is writable now */ if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS; -- -2.26.2 +2.20.1 diff --git a/patches/ntdll-WRITECOPY/0009-kernel32-tests-psapi-tests-Update-tests.patch b/patches/ntdll-WRITECOPY/0009-kernel32-tests-psapi-tests-Update-tests.patch index c1022e83..96659470 100644 --- a/patches/ntdll-WRITECOPY/0009-kernel32-tests-psapi-tests-Update-tests.patch +++ b/patches/ntdll-WRITECOPY/0009-kernel32-tests-psapi-tests-Update-tests.patch @@ -1,4 +1,4 @@ -From dacc9e9e6a5759cfd00ac9653a08ac78e604f243 Mon Sep 17 00:00:00 2001 +From a27883925e3317291e15798a1114d019d289d857 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Mon, 27 Apr 2020 15:32:22 +0300 Subject: [PATCH] kernel32/tests, psapi/tests: Update tests. @@ -9,7 +9,7 @@ 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 f576d132d8b..70824d771ed 100644 +index f576d132d8b5..70824d771ed2 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -3572,9 +3572,7 @@ static void test_CreateFileMapping_protection(void) @@ -98,7 +98,7 @@ index f576d132d8b..70824d771ed 100644 CloseHandle( hfile ); diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c -index da7524dd60a..eb52fc690cf 100644 +index da7524dd60a0..eb52fc690cfd 100644 --- a/dlls/psapi/tests/psapi_main.c +++ b/dlls/psapi/tests/psapi_main.c @@ -791,7 +791,7 @@ free_page: @@ -195,5 +195,5 @@ index da7524dd60a..eb52fc690cf 100644 START_TEST(psapi_main) -- -2.26.2 +2.20.1