fix stack protector crashes on x32 & powerpc due to misplaced TLS canary
[musl] / src / internal / pthread_impl.h
index 56877b3..e29f9c8 100644 (file)
@@ -16,7 +16,7 @@ struct pthread {
        struct pthread *self;
        void **dtv, *unused1, *unused2;
        uintptr_t sysinfo;
-       uintptr_t canary;
+       uintptr_t canary, canary2;
        pid_t tid, pid;
        int tsd_used, errno_val;
        volatile int cancel, canceldisable, cancelasync;
@@ -47,6 +47,7 @@ struct pthread {
        char *dlerror_buf;
        int dlerror_flag;
        void *stdio_locks;
+       uintptr_t canary_at_end;
        void **dtv_copy;
 };
 
@@ -89,6 +90,10 @@ struct __timer {
 
 #include "pthread_arch.h"
 
+#ifndef CANARY
+#define CANARY canary
+#endif
+
 #define SIGTIMER 32
 #define SIGCANCEL 33
 #define SIGSYNCCALL 34