]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
Allocate extra space in TLS for the stack protector canary.
authorAntti Kantee <pooka@iki.fi>
Tue, 5 May 2015 20:53:46 +0000 (20:53 +0000)
committerAntti Kantee <pooka@iki.fi>
Tue, 5 May 2015 20:53:46 +0000 (20:53 +0000)
It's difficult to catch all the places where -fno-stack-protector
is required, so at least ensure that the stack protector doesn't
dereference random garbage.

include/bmk-core/sched.h
lib/libbmk_core/sched.c

index b0b056716f92acdfd45bdb8e1ba697a67d518ca9..de558ddc918e5cba8007d492e020dbb5959b6412 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <bmk-core/types.h>
 
+#define BMK_TLS_EXTRA (6 * sizeof(unsigned long))
 struct bmk_tcb {
        unsigned long btcb_sp;          /* stack pointer        */
        unsigned long btcb_ip;          /* program counter      */
index 51215d6ff21d8a5305baebdff63ea5650a4ac855..a5b8eb66854a2d9353f702b8c8e2383793b8f2f7 100644 (file)
@@ -265,7 +265,7 @@ allocothertls(struct bmk_thread *thread)
        unsigned long *tcbptr;
        char *tlsmem;
 
-       tlsmem = bmk_memalloc(tdatasize + tbsssize + sizeof(unsigned long), 0);
+       tlsmem = bmk_memalloc(tdatasize + tbsssize + BMK_TLS_EXTRA, 0);
 
        bmk_memcpy(tlsmem, _tdata_start, tdatasize);
        bmk_memset(tlsmem + tdatasize, 0, tbsssize);