2014-01-07 21:43:34 +00:00
|
|
|
static inline struct pthread *__pthread_self()
|
|
|
|
{
|
|
|
|
struct pthread *self;
|
2018-10-16 18:08:01 +00:00
|
|
|
__asm__ ("mov %%fs:0,%0" : "=r" (self) );
|
2014-01-07 21:43:34 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2015-11-02 17:39:28 +00:00
|
|
|
#define MC_PC gregs[REG_RIP]
|
fix stack protector crashes on x32 & powerpc due to misplaced TLS canary
i386, x86_64, x32, and powerpc all use TLS for stack protector canary
values in the default stack protector ABI, but the location only
matched the ABI on i386 and x86_64. on x32, the expected location for
the canary contained the tid, thus producing spurious mismatches
(resulting in process termination) upon fork. on powerpc, the expected
location contained the stdio_locks list head, so returning from a
function after calling flockfile produced spurious mismatches. in both
cases, the random canary was not present, and a predictable value was
used instead, making the stack protector hardening much less effective
than it should be.
in the current fix, the thread structure has been expanded to have
canary fields at all three possible locations, and archs that use a
non-default location must define a macro in pthread_arch.h to choose
which location is used. for most archs (which lack TLS canary ABI) the
choice does not matter.
2015-05-06 22:37:19 +00:00
|
|
|
|
|
|
|
#define CANARY canary2
|
2017-01-13 10:28:46 +00:00
|
|
|
|
|
|
|
#define tls_mod_off_t unsigned long long
|