Browse Source
This is a long-standing thinko. When you exec a process, dll_crt0_0 in the child process calls child_info_spawn::handle_spawn(). handle_spawn() initialises the cygheap. Now consider calling strace. Strace is a non-Cygwin process dynamically loading cygwin1.dll via LoadLibrary. This in turn initializes the DLL: - dll_crt0_0 finds that the process it attaches to has been exec'd, so child_info_spawn::handle_spawn() is called. - If the DLL is being dynamically loaded, handle_spawn() calls child_info_spawn::get_parent_handle(). This in turn tries to set the moreinfo->myself_pinfo value inside the cygheap to NULL. - However, at this time, the cygheap has not yet been initialized. This only occurs in the cygheap_fixup_in_child() call after get_parent_handle() returns. --> SEGV This thinko never had a negative side effect, because the cygheap was pre-allocated at DLL load time until commitcygwin-3_4-branch2f9b8ff00c("Cygwin: decouple cygheap from Cygwin DLL"). With2f9b8ff00c, the cygheap actually doesn't exist until after the call to cygheap_fixup_in_child(). Fix this problem by moving the assignment after the call to cygheap_fixup_in_child(). Fixes:3de7be4c1d("* DevNotes: Add entry cgf-000007. [...]") Fixes:2f9b8ff00c("Cygwin: decouple cygheap from Cygwin DLL") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
1 changed files with 2 additions and 1 deletions
Loading…
Reference in new issue