Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Alexandre Julliard
Piotr Caban writes: > It happens when native _resetstkoflw is called when there's little > memory left on the stack. I don't know if there's any real application > that is calling it in that case. I thought that it's incorrect to grow > the stack size above stack limit anyway. No, the stack limi

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Piotr Caban
On 04/07/11 11:22, Alexandre Julliard wrote: Piotr Caban writes: Without this patch there's following condition for stack growing: if ((char *)page + page_size == NtCurrentTeb()->Tib.StackLimit) NtCurrentTeb()->Tib.StackLimit = page; If after growing the stack application protects the

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Alexandre Julliard
Piotr Caban writes: > Without this patch there's following condition for stack growing: > if ((char *)page + page_size == NtCurrentTeb()->Tib.StackLimit) > NtCurrentTeb()->Tib.StackLimit = page; > If after growing the stack application protects the memory between > StackLimit and StackLimit

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Piotr Caban
On 04/07/11 11:00, Alexandre Julliard wrote: Piotr Caban writes: It's not needed (I thought it may be not valid for whole stack). I'll send fixed version. There also should be "growing" instead of "shrinking" in commit message. It was meant to point that it's possible to change StackLimit mor

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Alexandre Julliard
Piotr Caban writes: > It's not needed (I thought it may be not valid for whole stack). I'll > send fixed version. > > There also should be "growing" instead of "shrinking" in commit > message. It was meant to point that it's possible to change StackLimit > more then once without this patch. I'm

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Piotr Caban
On 04/07/11 10:24, Alexandre Julliard wrote: Piotr Caban writes: @@ -1617,9 +1617,18 @@ BOOL virtual_handle_stack_fault( void *addr ) BYTE vprot = view->prot[((const char *)page - (const char *)view->base)>> page_shift]; if (vprot& VPROT_GUARD) { +s

Re: [PATCH 1/2] ntdll: Restore stack guard and prevent stack from shrinking

2011-04-07 Thread Alexandre Julliard
Piotr Caban writes: > @@ -1617,9 +1617,18 @@ BOOL virtual_handle_stack_fault( void *addr ) > BYTE vprot = view->prot[((const char *)page - (const char > *)view->base) >> page_shift]; > if (vprot & VPROT_GUARD) > { > +struct _TEB *teb = NtCurrentTeb(); >