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.
@@ -1,7 +1,7 @@
static inline struct pthread *__pthread_self()
{
struct pthread *self;
- __asm__ ("movl %%gs:0,%0" : "=r" (self) );
+ __asm__ __volatile__ ("movl %%gs:0,%0" : "=r" (self) );
return self;
}
- __asm__ ("movq %%fs:0,%0" : "=r" (self) );
+ __asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) );