diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0730fd688..3518c5797 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2006-04-03 Christopher Faylor + + * dcrt0.cc (sm): Delete. + (alloc_stack_hard_way): Figure out where the stack lives here rather + than relying on previously filled out information which has been + invalid since 1.5.19. + 2006-03-31 Corinna Vinschen * fhandler_disk_file.cc (FS_IS_SAMBA_WITH_QUOTA): New define. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f65d77213..564e6efbd 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -452,7 +452,6 @@ check_sanity_and_sync (per_process *p) } child_info NO_COPY *child_proc_info = NULL; -static MEMORY_BASIC_INFORMATION NO_COPY sm; #define CYGWIN_GUARD ((wincap.has_page_guard ()) ? \ PAGE_EXECUTE_READWRITE|PAGE_GUARD : PAGE_NOACCESS) @@ -464,10 +463,14 @@ alloc_stack_hard_way (child_info_fork *ci, volatile char *b) MEMORY_BASIC_INFORMATION m; void *newbase; int newlen; - LPBYTE curbot = (LPBYTE) sm.BaseAddress + sm.RegionSize; bool noguard; - if (ci->stacktop > (LPBYTE) sm.AllocationBase && ci->stacktop < curbot) + if (!VirtualQuery ((LPCVOID) &b, &m, sizeof m)) + api_fatal ("fork: couldn't get stack info, %E"); + + LPBYTE curbot = (LPBYTE) m.BaseAddress + m.RegionSize; + + if (ci->stacktop > (LPBYTE) m.AllocationBase && ci->stacktop < curbot) { newbase = curbot; newlen = (LPBYTE) ci->stackbottom - (LPBYTE) curbot;