Alexandre Julliard : ntdll: Don' t clear the last page of the initial stack.

Alexandre Julliard julliard at winehq.org
Tue Sep 19 15:47:04 CDT 2017


Module: wine
Branch: master
Commit: 9979c793e80cf91d15efb3b87f99080b59f0450b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9979c793e80cf91d15efb3b87f99080b59f0450b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 19 12:03:09 2017 +0200

ntdll: Don't clear the last page of the initial stack.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c  | 2 +-
 dlls/ntdll/virtual.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1bfd8f1..31d8323 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3152,7 +3152,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
     if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) goto error;
     heap_set_debug_flags( GetProcessHeap() );
 
-    status = wine_call_on_stack( attach_process_dlls, wm, NtCurrentTeb()->Tib.StackBase );
+    status = wine_call_on_stack( attach_process_dlls, wm, (char *)NtCurrentTeb()->Tib.StackBase - page_size );
     if (status != STATUS_SUCCESS) goto error;
 
     virtual_release_address_space();
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index e4896ea..a452c58 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1745,8 +1745,8 @@ void virtual_clear_thread_stack(void)
     void *stack = NtCurrentTeb()->Tib.StackLimit;
     size_t size = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
 
-    wine_anon_mmap( stack, size, PROT_READ | PROT_WRITE, MAP_FIXED );
-    if (force_exec_prot) mprotect( stack, size, PROT_READ | PROT_WRITE | PROT_EXEC );
+    wine_anon_mmap( stack, size - page_size, PROT_READ | PROT_WRITE, MAP_FIXED );
+    if (force_exec_prot) mprotect( stack, size - page_size, PROT_READ | PROT_WRITE | PROT_EXEC );
 }
 
 




More information about the wine-cvs mailing list