mirror of git://git.musl-libc.org/musl
ensure the compiler does not move around thread-register-based reads
if gcc decided to move this across a conditional that checks validity of the thread register, an invalid thread-register-based read could be performed and raise sigsegv.
This commit is contained in:
parent
357876052b
commit
8426a99048
|
@ -1,7 +1,7 @@
|
||||||
static inline struct pthread *__pthread_self()
|
static inline struct pthread *__pthread_self()
|
||||||
{
|
{
|
||||||
struct pthread *self;
|
struct pthread *self;
|
||||||
__asm__ ("movl %%gs:0,%0" : "=r" (self) );
|
__asm__ __volatile__ ("movl %%gs:0,%0" : "=r" (self) );
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
static inline struct pthread *__pthread_self()
|
static inline struct pthread *__pthread_self()
|
||||||
{
|
{
|
||||||
struct pthread *self;
|
struct pthread *self;
|
||||||
__asm__ ("movq %%fs:0,%0" : "=r" (self) );
|
__asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) );
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue