]> xenbits.xensource.com Git - xtf.git/commitdiff
XSA-260: Work around toolchain problems with older GCC
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Jun 2018 11:13:24 +0000 (12:13 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Jun 2018 11:13:24 +0000 (12:13 +0100)
GCC 4.4.7 of RHEL/CentOS 6 vintage can't cope with an ebp/rbp register clobber
when compiling with frame pointers enabled.  Switch to ebx/rbx instead.

Reported-by: Glenn Enright <glenn@rimuhosting.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Glenn Enright <glenn@rimuhosting.com>
tests/xsa-260/main.c

index 2f30f6fccc5ea00a472054d4806de344edc29917..51e73848a0e456a5e2fd7e51fadc83431103d7ef 100644 (file)
@@ -43,7 +43,7 @@ static void undo_stack(struct cpu_regs *regs)
     if ( IS_DEFINED(CONFIG_32BIT) )
         ASSERT((regs->cs & 3) == 3);
 
-    regs->_sp = regs->bp;
+    regs->_sp = regs->bx;
 }
 
 void do_syscall(struct cpu_regs *regs)
@@ -79,7 +79,7 @@ static bool ex_check_UD(struct cpu_regs *regs, const struct extable_entry *ex)
 static void __user_text user_syscall(void)
 {
     asm volatile (/* Stash the stack pointer before clobbering it. */
-                  "mov %%" _ASM_SP ", %%" _ASM_BP ";"
+                  "mov %%" _ASM_SP ", %%" _ASM_BX ";"
 
                   "btc $%c[bit], %%" _ASM_SP ";"
                   "mov %[ss], %%ss;"
@@ -90,9 +90,9 @@ static void __user_text user_syscall(void)
                     [ss]  "m" (user_ss),
                     "X" (ex_check_UD)
 #ifdef __x86_64__
-                  : "rbp", "rcx", "r11"
+                  : "rbx", "rcx", "r11"
 #else
-                  : "ebp", "ecx", "edx"
+                  : "ebx", "ecx", "edx"
 #endif
         );
 }
@@ -100,7 +100,7 @@ static void __user_text user_syscall(void)
 static void __user_text user_syscall_compat(void)
 {
     asm volatile (/* Stash the stack pointer before clobbering it. */
-                  "mov %%" _ASM_SP ", %%" _ASM_BP ";"
+                  "mov %%" _ASM_SP ", %%" _ASM_BX ";"
 
                   /* Drop to a 32bit compat code segment. */
                   "push $%c[cs32];"
@@ -129,9 +129,9 @@ static void __user_text user_syscall_compat(void)
                     [cs64]   "i" (__USER_CS),
                     "X" (ex_check_UD)
 #ifdef __x86_64__
-                  : "rbp", "rcx", "r11"
+                  : "rbx", "rcx", "r11"
 #else
-                  : "ebp", "ecx", "edx"
+                  : "ebx", "ecx", "edx"
 #endif
         );
 }