Always restore full TEB stack info in forkee
* dcrt0.cc (dll_crt0_1): Always restore the TEB stack info. Especially restore DeallocationStack. Fix comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
600c445127
commit
111f32f4ba
@ -1,3 +1,8 @@
|
|||||||
|
2015-12-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* crt0.cc (dll_crt0_1): Always restore the TEB stack info. Especially
|
||||||
|
restore DeallocationStack. Fix comment.
|
||||||
|
|
||||||
2015-12-03 Corinna Vinschen <corinna@vinschen.de>
|
2015-12-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* dcrt0.cc (child_info_fork::alloc_stack): Don't set stackaddr to 0.
|
* dcrt0.cc (child_info_fork::alloc_stack): Don't set stackaddr to 0.
|
||||||
|
@ -910,18 +910,18 @@ dll_crt0_1 (void *)
|
|||||||
cygbench ("pre-forkee");
|
cygbench ("pre-forkee");
|
||||||
if (in_forkee)
|
if (in_forkee)
|
||||||
{
|
{
|
||||||
/* If we've played with the stack, stacksize != 0. That means that
|
/* Make sure to restore the TEB's stack info. If guardsize is -1 the
|
||||||
fork() was invoked from other than the main thread. Make sure that
|
stack has been provided by the application and must not be deallocated
|
||||||
frame pointer is referencing the new stack so that the OS knows what
|
automagically when the thread exits.
|
||||||
to do when it needs to increase the size of the stack.
|
|
||||||
|
|
||||||
NOTE: Don't do anything that involves the stack until you've completed
|
NOTE: Don't do anything that involves the stack until you've completed
|
||||||
this step. */
|
this step. */
|
||||||
if (fork_info->stackaddr)
|
PTEB teb = NtCurrentTeb ();
|
||||||
{
|
teb->Tib.StackBase = (PVOID) fork_info->stackbase;
|
||||||
NtCurrentTeb()->Tib.StackBase = (PVOID) fork_info->stackbase;
|
teb->Tib.StackLimit = (PVOID) fork_info->stacklimit;
|
||||||
NtCurrentTeb()->Tib.StackLimit = (PVOID) fork_info->stacklimit;
|
teb->DeallocationStack = (fork_info->guardsize == (size_t) -1)
|
||||||
}
|
? NULL
|
||||||
|
: (PVOID) fork_info->stackaddr;
|
||||||
|
|
||||||
/* Not resetting _my_tls.incyg here because presumably fork will overwrite
|
/* Not resetting _my_tls.incyg here because presumably fork will overwrite
|
||||||
it with the value of the forker and all will be good. */
|
it with the value of the forker and all will be good. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user