Don't require execute permission for thread stacks.

This commit is contained in:
Alexandre Julliard 2005-06-21 09:57:53 +00:00
parent 04f9f1b066
commit 60b3d30f9b
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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 )
/* 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;
} }

View File

@ -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 )
/* 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();