diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-08-06 20:45:30 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-08-06 20:45:30 -0400 |
commit | 8426a99048261b998a27557cf34f81626ffe9f12 (patch) | |
tree | 4df1b3180ee6facecada2150406e9e003904f479 /arch | |
parent | 357876052b125dcd74882f61afec19d8f519074c (diff) | |
download | musl-8426a99048261b998a27557cf34f81626ffe9f12.tar.gz musl-8426a99048261b998a27557cf34f81626ffe9f12.tar.xz musl-8426a99048261b998a27557cf34f81626ffe9f12.zip |
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.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/pthread_arch.h | 2 | ||||
-rw-r--r-- | arch/x86_64/pthread_arch.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/i386/pthread_arch.h b/arch/i386/pthread_arch.h index b17dc87a..0ea0aaca 100644 --- a/arch/i386/pthread_arch.h +++ b/arch/i386/pthread_arch.h @@ -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; } 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; } |