[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [IA64] fix paravirtualization of clone2() system call.



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 8254ba7c0defcebb9b439a91468b6cfae89b5dc2
# Parent  357a3c90d67bad40b0bd511eea117db250486c5d
[IA64] fix paravirtualization of clone2() system call.

If audit is enabled or the child process is ptraced,
non-paravirtualized code path is executed.
Thus paravirtualized ifs is left unmodifed so that the child process
crashes after clone2().
paravirtualize ia64_ret_from_clone() to fix it.
 
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/ia64/kernel/entry.S      |    4 +-
 linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S      |   41 +++++++++++++++++++++
 linux-2.6-xen-sparse/include/asm-ia64/privop.h     |    1 
 linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h |    1 
 4 files changed, 45 insertions(+), 2 deletions(-)

diff -r 357a3c90d67b -r 8254ba7c0def 
linux-2.6-xen-sparse/arch/ia64/kernel/entry.S
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S     Wed Nov 22 09:30:27 
2006 -0700
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S     Wed Nov 22 10:10:38 
2006 -0700
@@ -602,7 +602,7 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
 .ret4: br.cond.sptk ia64_leave_kernel
 END(ia64_strace_leave_kernel)
 
-GLOBAL_ENTRY(ia64_ret_from_clone)
+GLOBAL_ENTRY(__ia64_ret_from_clone)
        PT_REGS_UNWIND_INFO(0)
 {      /*
         * Some versions of gas generate bad unwind info if the first 
instruction of a
@@ -628,7 +628,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
        cmp.ne p6,p0=r2,r0
 (p6)   br.cond.spnt .strace_check_retval
        ;;                                      // added stop bits to prevent 
r8 dependency
-END(ia64_ret_from_clone)
+END(__ia64_ret_from_clone)
        // fall through
 GLOBAL_ENTRY(ia64_ret_from_syscall)
        PT_REGS_UNWIND_INFO(0)
diff -r 357a3c90d67b -r 8254ba7c0def 
linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S     Wed Nov 22 09:30:27 
2006 -0700
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S     Wed Nov 22 10:10:38 
2006 -0700
@@ -237,6 +237,47 @@ END(ia64_trace_syscall)
 END(ia64_trace_syscall)
 #endif
 
+#ifdef CONFIG_XEN
+GLOBAL_ENTRY(xen_ret_from_clone)
+       PT_REGS_UNWIND_INFO(0)
+       movl r16=running_on_xen;;
+       ld4 r16=[r16];;
+       cmp.eq p7,p0=r16,r0
+(p7)   br.cond.sptk.many __ia64_ret_from_clone;;
+#else  
+GLOBAL_ENTRY(ia64_ret_from_clone)
+       PT_REGS_UNWIND_INFO(0)
+#endif 
+{      /*
+        * Some versions of gas generate bad unwind info if the first 
instruction of a
+        * procedure doesn't go into the first slot of a bundle.  This is a 
workaround.
+        */
+       nop.m 0
+       nop.i 0
+       /*
+        * We need to call schedule_tail() to complete the scheduling process.
+        * Called by ia64_switch_to() after do_fork()->copy_thread().  r8 
contains the
+        * address of the previously executing task.
+        */
+       br.call.sptk.many rp=ia64_invoke_schedule_tail
+}
+.ret8:
+       adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
+       ;;
+       ld4 r2=[r2]
+       ;;
+       mov r8=0
+       and r2=_TIF_SYSCALL_TRACEAUDIT,r2
+       ;;
+       cmp.ne p6,p0=r2,r0
+(p6)   br.cond.spnt .strace_check_retval
+       ;;                                      // added stop bits to prevent 
r8 dependency
+#ifdef CONFIG_XEN
+       br.cond.sptk ia64_ret_from_syscall
+END(xen_ret_from_clone)
+#else
+END(ia64_ret_from_clone)
+#endif         
 /*
  * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
  *     need to switch to bank 0 and doesn't restore the scratch registers.
diff -r 357a3c90d67b -r 8254ba7c0def 
linux-2.6-xen-sparse/include/asm-ia64/privop.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/privop.h    Wed Nov 22 09:30:27 
2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-ia64/privop.h    Wed Nov 22 10:10:38 
2006 -0700
@@ -49,6 +49,7 @@
 #define ia64_leave_kernel              __ia64_leave_kernel
 #define ia64_leave_syscall             __ia64_leave_syscall
 #define ia64_trace_syscall             __ia64_trace_syscall
+#define ia64_ret_from_clone            __ia64_ret_from_clone
 #define ia64_switch_to                 __ia64_switch_to
 #define ia64_pal_call_static           __ia64_pal_call_static
 
diff -r 357a3c90d67b -r 8254ba7c0def 
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Wed Nov 22 
09:30:27 2006 -0700
+++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Wed Nov 22 
10:10:38 2006 -0700
@@ -295,6 +295,7 @@ extern void xen_ptcga(unsigned long addr
 #define        ia64_leave_kernel               xen_leave_kernel
 #define        ia64_leave_syscall              xen_leave_syscall
 #define        ia64_trace_syscall              xen_trace_syscall
+#define        ia64_ret_from_clone             xen_ret_from_clone
 #define        ia64_switch_to                  xen_switch_to
 #define        ia64_pal_call_static            xen_pal_call_static
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.