diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 840f3961e..a1f49571d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2015-07-05 Corinna Vinschen + + * fhandler_process.cc (heap_info::heap_info): Disable fetching heap info + on 64 bit XP/2003. Explain why. + * wincap.h (wincaps::has_broken_rtl_query_process_debug_information): + New element. + * wincap.cc: Implement above element throughout. + 2015-07-04 Corinna Vinschen * autoload.cc (SetThreadStackGuarantee): Import. diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 161050b3b..d3ee874cd 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -592,7 +592,11 @@ struct heap_info NTSTATUS status; PDEBUG_HEAP_ARRAY harray; - buf = RtlCreateQueryDebugBuffer (0, FALSE); + /* FIXME? RtlQueryProcessDebugInformation/CreateToolhelp32Snapshot both + crash the target process on 64 bit XP/2003 in native 64 bit mode. */ + if (wincap.has_broken_rtl_query_process_debug_information ()) + return; + buf = RtlCreateQueryDebugBuffer (16 * 65536, FALSE); if (!buf) return; status = RtlQueryProcessDebugInformation (pid, PDI_HEAPS | PDI_HEAP_BLOCKS, diff --git a/winsup/cygwin/release/2.1.0 b/winsup/cygwin/release/2.1.0 index 93b84b98e..da484f5f4 100644 --- a/winsup/cygwin/release/2.1.0 +++ b/winsup/cygwin/release/2.1.0 @@ -25,3 +25,5 @@ Bug Fixes - Fix fork failing after the parent recovered from a stack overflow. Addresses: https://cygwin.com/ml/cygwin/2015-06/msg00384.html + +- Fix a crash on 64 bit XP/2003 when opening /proc/$PID/maps. diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 2c5880e96..8e07661fc 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -48,6 +48,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:false, has_microsoft_accounts:false, has_set_thread_stack_guarantee:false, + has_broken_rtl_query_process_debug_information:false, }; wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { @@ -78,6 +79,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:false, has_microsoft_accounts:false, has_set_thread_stack_guarantee:true, + has_broken_rtl_query_process_debug_information:true, }; wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { @@ -108,6 +110,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:false, has_microsoft_accounts:false, has_set_thread_stack_guarantee:true, + has_broken_rtl_query_process_debug_information:false, }; wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { @@ -138,6 +141,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:false, has_microsoft_accounts:false, has_set_thread_stack_guarantee:true, + has_broken_rtl_query_process_debug_information:false, }; wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { @@ -168,6 +172,7 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:true, has_microsoft_accounts:true, has_set_thread_stack_guarantee:true, + has_broken_rtl_query_process_debug_information:false, }; wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = { @@ -198,6 +203,7 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = { has_precise_system_time:true, has_microsoft_accounts:true, has_set_thread_stack_guarantee:true, + has_broken_rtl_query_process_debug_information:false, }; wincapc wincap __attribute__((section (".cygwin_dll_common"), shared)); @@ -255,6 +261,10 @@ wincapc::init () /* 64 bit systems have one more guard page than their 32 bit counterpart. */ ++((wincaps *)caps)->def_guard_pages; #else + /* RtlQueryProcessDebugInformation/CreateToolhelp32Snapshot both crash the + target process on 64 bit XP/2003 in native 64 bit mode only. Reset the + flag here for 32 bit. */ + ((wincaps *)caps)->has_broken_rtl_query_process_debug_information = false; if (NT_SUCCESS (NtQueryInformationProcess (NtCurrentProcess (), ProcessWow64Information, &wow64, sizeof wow64, NULL)) diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 160085d77..1d5cfda60 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -41,6 +41,7 @@ struct wincaps unsigned has_precise_system_time : 1; unsigned has_microsoft_accounts : 1; unsigned has_set_thread_stack_guarantee : 1; + unsigned has_broken_rtl_query_process_debug_information : 1; }; class wincapc @@ -96,6 +97,7 @@ public: bool IMPLEMENT (has_precise_system_time) bool IMPLEMENT (has_microsoft_accounts) bool IMPLEMENT (has_set_thread_stack_guarantee) + bool IMPLEMENT (has_broken_rtl_query_process_debug_information) #undef IMPLEMENT };