Fix original stack when running signal handler on alternate stack
* autoload.cc (SetThreadStackGuarantee): Import. * cygtls.h (struct _cygtls): Replace thread_context with a ucontext_t called context. * exceptions.cc (exception::handle): Exit from process via signal_exit in case sig_send returns from handling a stack overflow SIGSEGV. Explain why. (dumpstack_overflow_wrapper): Thread wrapper to create a stackdump from another thread. (signal_exit): Fix argument list to reflect three-arg signal handler. In case we have to create a stackdump for a stack overflow condition, do so from a separate thread. Explain why. (sigpacket::process): Don't run signal_exit on alternate stack. (altstack_wrapper): Wrapper function to do stack correction when calling the signal handler on an alternate stack to handle a stack overflow. Make sure to have lots of comments. (_cygtls::call_signal_handler): Drop local context variable to reduce stack pressure. Use this->context instead. Change inline assembler to call altstack_wrapper. (_cygtls::signal_debugger): Accommodate aforementioned change to struct _cygtls. * tlsoffset.h: Regenerate. * tlsoffset64.h: Regenerate. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@@ -21,6 +21,7 @@ details. */
|
||||
puzzled that this has never been noticed before... */
|
||||
|
||||
wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:1,
|
||||
max_sys_priv:SE_CREATE_GLOBAL_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:false,
|
||||
@@ -46,9 +47,11 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:false,
|
||||
has_precise_system_time:false,
|
||||
has_microsoft_accounts:false,
|
||||
has_set_thread_stack_guarantee:false,
|
||||
};
|
||||
|
||||
wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:1,
|
||||
max_sys_priv:SE_CREATE_GLOBAL_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:false,
|
||||
@@ -74,9 +77,11 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:false,
|
||||
has_precise_system_time:false,
|
||||
has_microsoft_accounts:false,
|
||||
has_set_thread_stack_guarantee:true,
|
||||
};
|
||||
|
||||
wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:1,
|
||||
max_sys_priv:SE_CREATE_SYMBOLIC_LINK_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:true,
|
||||
@@ -102,9 +107,11 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:true,
|
||||
has_precise_system_time:false,
|
||||
has_microsoft_accounts:false,
|
||||
has_set_thread_stack_guarantee:true,
|
||||
};
|
||||
|
||||
wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:1,
|
||||
max_sys_priv:SE_CREATE_SYMBOLIC_LINK_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:true,
|
||||
@@ -130,9 +137,11 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:true,
|
||||
has_precise_system_time:false,
|
||||
has_microsoft_accounts:false,
|
||||
has_set_thread_stack_guarantee:true,
|
||||
};
|
||||
|
||||
wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:2,
|
||||
max_sys_priv:SE_CREATE_SYMBOLIC_LINK_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:true,
|
||||
@@ -158,9 +167,11 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:true,
|
||||
has_precise_system_time:true,
|
||||
has_microsoft_accounts:true,
|
||||
has_set_thread_stack_guarantee:true,
|
||||
};
|
||||
|
||||
wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
def_guard_pages:2,
|
||||
max_sys_priv:SE_CREATE_SYMBOLIC_LINK_PRIVILEGE,
|
||||
is_server:false,
|
||||
has_mandatory_integrity_control:true,
|
||||
@@ -186,6 +197,7 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||
terminate_thread_frees_stack:true,
|
||||
has_precise_system_time:true,
|
||||
has_microsoft_accounts:true,
|
||||
has_set_thread_stack_guarantee:true,
|
||||
};
|
||||
|
||||
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
|
||||
@@ -240,6 +252,8 @@ wincapc::init ()
|
||||
((wincaps *)caps)->is_server = (version.wProductType != VER_NT_WORKSTATION);
|
||||
#ifdef __x86_64__
|
||||
wow64 = 0;
|
||||
/* 64 bit systems have one more guard page than their 32 bit counterpart. */
|
||||
++((wincaps *)caps)->def_guard_pages;
|
||||
#else
|
||||
if (NT_SUCCESS (NtQueryInformationProcess (NtCurrentProcess (),
|
||||
ProcessWow64Information,
|
||||
|
Reference in New Issue
Block a user