From 8426a99048261b998a27557cf34f81626ffe9f12 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 6 Aug 2011 20:45:30 -0400 Subject: 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. --- arch/x86_64/pthread_arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86_64/pthread_arch.h') diff --git a/arch/x86_64/pthread_arch.h b/arch/x86_64/pthread_arch.h index c424493a..836187f5 100644 --- a/arch/x86_64/pthread_arch.h +++ b/arch/x86_64/pthread_arch.h @@ -1,7 +1,7 @@ static inline struct pthread *__pthread_self() { struct pthread *self; - __asm__ ("movq %%fs:0,%0" : "=r" (self) ); + __asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) ); return self; } -- cgit v1.2.1