aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/cygtls.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-07-04 22:49:30 +0200
committerCorinna Vinschen <corinna@vinschen.de>2015-07-04 22:49:30 +0200
commit2cd7eb7f60208b0ffd51a9e117a8846c33b4ad41 (patch)
tree0ebf0d1b51a4bd5642c288b0572939399df962a4 /winsup/cygwin/cygtls.h
parent757c0871f74c3a2d682398490bcae8873d1fafd4 (diff)
downloadnewlib-2cd7eb7f60208b0ffd51a9e117a8846c33b4ad41.zip
newlib-2cd7eb7f60208b0ffd51a9e117a8846c33b4ad41.tar.gz
newlib-2cd7eb7f60208b0ffd51a9e117a8846c33b4ad41.tar.bz2
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>
Diffstat (limited to 'winsup/cygwin/cygtls.h')
-rw-r--r--winsup/cygwin/cygtls.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h
index 0944811..3dfffbb 100644
--- a/winsup/cygwin/cygtls.h
+++ b/winsup/cygwin/cygtls.h
@@ -17,6 +17,7 @@ details. */
#include <mntent.h>
#undef _NOMNTENT_FUNCS
#include <setjmp.h>
+#include <ucontext.h>
#define CYGTLS_INITIALIZED 0xc763173f
@@ -192,7 +193,8 @@ public:
siginfo_t *sigwait_info;
HANDLE signal_arrived;
bool will_wait_for_signal;
- CONTEXT thread_context;
+ long __align; /* Needed to align context to 16 byte. */
+ ucontext_t context;
DWORD thread_id;
siginfo_t infodata;
struct pthread *tid;