Skip to contentSkip to conversation

x86: Fix vsyscall on gcc 4.5 with -Os

PATCH In review Andi Kleen 1 participant 2 messages Jun 18, 2010 x86

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 x86: Fix vsyscall on gcc 4.5 with -Os

x86: Fix vsyscall on gcc 4.5 with -Os

This fixes the -Os breaks with gcc 4.5 bug. rdtsc_barrier needs to be force inlined, otherwise user space will jump into kernel space and kill init.

This also addresses
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44129
I believe

---
 arch/x86/include/asm/system.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/system.h +1 -1
Index: linux-2.6.34-ak/arch/x86/include/asm/system.h
===================================================================
@@ -451,7 +451,7 @@ void stop_this_cpu(void *dummy);
  *
  * (Could use an alternative three way for this if there was one.)
  */
-static inline void rdtsc_barrier(void)
+static __always_inline void rdtsc_barrier(void)
 {
 	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
 	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
#1 lore raw
Commit-ID:  124482935fb7fb9303c8a8ab930149c6a93d9910
Gitweb:     http://git.kernel.org/tip/124482935fb7fb9303c8a8ab930149c6a93d9910
Author:     Andi Kleen <[email protected]>
AuthorDate: Fri, 18 Jun 2010 23:09:00 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 18 Jun 2010 14:16:31 -0700

x86: Fix vsyscall on gcc 4.5 with -Os

This fixes the -Os breaks with gcc 4.5 bug. rdtsc_barrier needs to be force inlined, otherwise user space will jump into kernel space and kill init.

This also addresses http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44129
I believe.

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/system.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/system.h +1 -1
index b8fe48e..e7f4d33 100644
@@ -451,7 +451,7 @@ void stop_this_cpu(void *dummy);
  *
  * (Could use an alternative three way for this if there was one.)
  */
-static inline void rdtsc_barrier(void)
+static __always_inline void rdtsc_barrier(void)
 {
 	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
 	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);