ntdll: Don't use a real guard page at the bottom of the stack.

A no-access page is enough, we can't properly raise an overflow
exception anyway.
This commit is contained in:
Alexandre Julliard 2005-12-17 18:47:03 +01:00
parent f0c55e7d52
commit efffa66330
3 changed files with 4 additions and 9 deletions

View File

@ -994,7 +994,7 @@ static void *init_stack(void)
NtCurrentTeb()->Tib.StackLimit = (char *)base + page_size;
/* setup guard page */
VirtualProtect( base, 1, PAGE_READWRITE | PAGE_GUARD, NULL );
VirtualProtect( base, page_size, PAGE_NOACCESS, NULL );
return NtCurrentTeb()->Tib.StackBase;
}

View File

@ -223,8 +223,7 @@ static void start_thread( struct wine_pthread_thread_info *info )
/* setup the guard page */
size = page_size;
NtProtectVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, &size,
PAGE_READWRITE | PAGE_GUARD, NULL );
NtProtectVirtualMemory( NtCurrentProcess(), &teb->DeallocationStack, &size, PAGE_NOACCESS, NULL );
RtlFreeHeap( GetProcessHeap(), 0, info );
RtlAcquirePebLock();

View File

@ -1178,17 +1178,13 @@ NTSTATUS VIRTUAL_HandleFault( LPCVOID addr )
RtlEnterCriticalSection( &csVirtual );
if ((view = VIRTUAL_FindView( addr )))
{
BYTE vprot = view->prot[((const char *)addr - (const char *)view->base) >> page_shift];
void *page = (void *)((UINT_PTR)addr & ~page_mask);
char *stack = NtCurrentTeb()->Tib.StackLimit;
void *page = ROUND_ADDR( addr, page_mask );
BYTE vprot = view->prot[((const char *)page - (const char *)view->base) >> page_shift];
if (vprot & VPROT_GUARD)
{
VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD );
ret = STATUS_GUARD_PAGE_VIOLATION;
}
/* is it inside the stack guard page? */
if (((const char *)addr >= stack - (page_mask + 1)) && ((const char *)addr < stack))
ret = STATUS_STACK_OVERFLOW;
}
RtlLeaveCriticalSection( &csVirtual );
return ret;