Disable fetching heap info on 64 bit XP/2003

* 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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2015-07-05 12:51:52 +02:00
parent f0464fbf9d
commit e426213a88
5 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2015-07-05 Corinna Vinschen <corinna@vinschen.de>
* 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 <corinna@vinschen.de>
* autoload.cc (SetThreadStackGuarantee): Import.

View File

@ -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,

View File

@ -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.

View File

@ -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))

View File

@ -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
};