Commit 60b3d30f authored by Alexandre Julliard's avatar Alexandre Julliard

Don't require execute permission for thread stacks.

parent 04f9f1b0
...@@ -93,7 +93,7 @@ LPVOID WINAPI CreateFiberEx( SIZE_T stack_commit, SIZE_T stack_reserve, DWORD fl ...@@ -93,7 +93,7 @@ LPVOID WINAPI CreateFiberEx( SIZE_T stack_commit, SIZE_T stack_reserve, DWORD fl
/* FIXME: should use the thread stack allocation routines here */ /* FIXME: should use the thread stack allocation routines here */
if (!stack_reserve) stack_reserve = 1024*1024; if (!stack_reserve) stack_reserve = 1024*1024;
if(!(fiber->stack_allocation = VirtualAlloc( 0, stack_reserve, MEM_COMMIT, PAGE_EXECUTE_READWRITE ))) if(!(fiber->stack_allocation = VirtualAlloc( 0, stack_reserve, MEM_COMMIT, PAGE_READWRITE )))
{ {
HeapFree( GetProcessHeap(), 0, fiber ); HeapFree( GetProcessHeap(), 0, fiber );
return NULL; return NULL;
......
...@@ -66,7 +66,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size ) ...@@ -66,7 +66,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
stack_size = (stack_size + (page_size - 1)) & ~(page_size - 1); stack_size = (stack_size + (page_size - 1)) & ~(page_size - 1);
if (stack_size < 1024 * 1024) stack_size = 1024 * 1024; /* Xlib needs a large stack */ if (stack_size < 1024 * 1024) stack_size = 1024 * 1024; /* Xlib needs a large stack */
if (!(base = VirtualAlloc( NULL, stack_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE ))) if (!(base = VirtualAlloc( NULL, stack_size, MEM_COMMIT, PAGE_READWRITE )))
return NULL; return NULL;
teb->DeallocationStack = base; teb->DeallocationStack = base;
...@@ -75,7 +75,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size ) ...@@ -75,7 +75,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
/* Setup guard pages */ /* Setup guard pages */
VirtualProtect( base, 1, PAGE_EXECUTE_READWRITE | PAGE_GUARD, &old_prot ); VirtualProtect( base, 1, PAGE_READWRITE | PAGE_GUARD, &old_prot );
return teb; return teb;
} }
......
...@@ -192,7 +192,7 @@ static void start_thread( struct wine_pthread_thread_info *info ) ...@@ -192,7 +192,7 @@ static void start_thread( struct wine_pthread_thread_info *info )
size = info->stack_size; size = info->stack_size;
teb->DeallocationStack = info->stack_base; teb->DeallocationStack = info->stack_base;
NtAllocateVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, 0, NtAllocateVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, 0,
&size, MEM_SYSTEM, PAGE_EXECUTE_READWRITE ); &size, MEM_SYSTEM, PAGE_READWRITE );
/* limit is lower than base since the stack grows down */ /* limit is lower than base since the stack grows down */
teb->Tib.StackBase = (char *)info->stack_base + info->stack_size; teb->Tib.StackBase = (char *)info->stack_base + info->stack_size;
teb->Tib.StackLimit = info->stack_base; teb->Tib.StackLimit = info->stack_base;
...@@ -200,7 +200,7 @@ static void start_thread( struct wine_pthread_thread_info *info ) ...@@ -200,7 +200,7 @@ static void start_thread( struct wine_pthread_thread_info *info )
/* setup the guard page */ /* setup the guard page */
size = 1; size = 1;
NtProtectVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, &size, NtProtectVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, &size,
PAGE_EXECUTE_READWRITE | PAGE_GUARD, NULL ); PAGE_READWRITE | PAGE_GUARD, NULL );
RtlFreeHeap( GetProcessHeap(), 0, info ); RtlFreeHeap( GetProcessHeap(), 0, info );
RtlAcquirePebLock(); RtlAcquirePebLock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment