3 #include "pthread_impl.h"
5 uintptr_t __stack_chk_guard
;
7 void __init_ssp(void *entropy
)
9 if (entropy
) memcpy(&__stack_chk_guard
, entropy
, sizeof(uintptr_t));
10 else __stack_chk_guard
= (uintptr_t)&__stack_chk_guard
* 1103515245;
12 #if UINTPTR_MAX >= 0xffffffffffffffff
13 /* Sacrifice 8 bits of entropy on 64bit to prevent leaking/
14 * overwriting the canary via string-manipulation functions.
15 * The NULL byte is on the second byte so that off-by-ones can
16 * still be detected. Endianness is taken care of
18 ((char *)&__stack_chk_guard
)[1] = 0;
21 __pthread_self()->canary
= __stack_chk_guard
;
24 void __stack_chk_fail(void)
29 hidden
void __stack_chk_fail_local(void);
31 weak_alias(__stack_chk_fail
, __stack_chk_fail_local
);