ia64/xen-unstable

changeset 12522:8254ba7c0def

[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@valinux.co.jp>
author awilliam@xenbuild.aw
date Wed Nov 22 10:10:38 2006 -0700 (2006-11-22)
parents 357a3c90d67b
children 0114b372dfae
files linux-2.6-xen-sparse/arch/ia64/kernel/entry.S linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S linux-2.6-xen-sparse/include/asm-ia64/privop.h linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Wed Nov 22 09:30:27 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Wed Nov 22 10:10:38 2006 -0700
     1.3 @@ -602,7 +602,7 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
     1.4  .ret4:	br.cond.sptk ia64_leave_kernel
     1.5  END(ia64_strace_leave_kernel)
     1.6  
     1.7 -GLOBAL_ENTRY(ia64_ret_from_clone)
     1.8 +GLOBAL_ENTRY(__ia64_ret_from_clone)
     1.9  	PT_REGS_UNWIND_INFO(0)
    1.10  {	/*
    1.11  	 * Some versions of gas generate bad unwind info if the first instruction of a
    1.12 @@ -628,7 +628,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
    1.13  	cmp.ne p6,p0=r2,r0
    1.14  (p6)	br.cond.spnt .strace_check_retval
    1.15  	;;					// added stop bits to prevent r8 dependency
    1.16 -END(ia64_ret_from_clone)
    1.17 +END(__ia64_ret_from_clone)
    1.18  	// fall through
    1.19  GLOBAL_ENTRY(ia64_ret_from_syscall)
    1.20  	PT_REGS_UNWIND_INFO(0)
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Wed Nov 22 09:30:27 2006 -0700
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Wed Nov 22 10:10:38 2006 -0700
     2.3 @@ -237,6 +237,47 @@ END(xen_trace_syscall)
     2.4  END(ia64_trace_syscall)
     2.5  #endif
     2.6  
     2.7 +#ifdef CONFIG_XEN
     2.8 +GLOBAL_ENTRY(xen_ret_from_clone)
     2.9 +	PT_REGS_UNWIND_INFO(0)
    2.10 +	movl r16=running_on_xen;;
    2.11 +	ld4 r16=[r16];;
    2.12 +	cmp.eq p7,p0=r16,r0
    2.13 +(p7)	br.cond.sptk.many __ia64_ret_from_clone;;
    2.14 +#else	
    2.15 +GLOBAL_ENTRY(ia64_ret_from_clone)
    2.16 +	PT_REGS_UNWIND_INFO(0)
    2.17 +#endif	
    2.18 +{	/*
    2.19 +	 * Some versions of gas generate bad unwind info if the first instruction of a
    2.20 +	 * procedure doesn't go into the first slot of a bundle.  This is a workaround.
    2.21 +	 */
    2.22 +	nop.m 0
    2.23 +	nop.i 0
    2.24 +	/*
    2.25 +	 * We need to call schedule_tail() to complete the scheduling process.
    2.26 +	 * Called by ia64_switch_to() after do_fork()->copy_thread().  r8 contains the
    2.27 +	 * address of the previously executing task.
    2.28 +	 */
    2.29 +	br.call.sptk.many rp=ia64_invoke_schedule_tail
    2.30 +}
    2.31 +.ret8:
    2.32 +	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
    2.33 +	;;
    2.34 +	ld4 r2=[r2]
    2.35 +	;;
    2.36 +	mov r8=0
    2.37 +	and r2=_TIF_SYSCALL_TRACEAUDIT,r2
    2.38 +	;;
    2.39 +	cmp.ne p6,p0=r2,r0
    2.40 +(p6)	br.cond.spnt .strace_check_retval
    2.41 +	;;					// added stop bits to prevent r8 dependency
    2.42 +#ifdef CONFIG_XEN
    2.43 +	br.cond.sptk ia64_ret_from_syscall
    2.44 +END(xen_ret_from_clone)
    2.45 +#else
    2.46 +END(ia64_ret_from_clone)
    2.47 +#endif		
    2.48  /*
    2.49   * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
    2.50   *	need to switch to bank 0 and doesn't restore the scratch registers.
     3.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/privop.h	Wed Nov 22 09:30:27 2006 -0700
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/privop.h	Wed Nov 22 10:10:38 2006 -0700
     3.3 @@ -49,6 +49,7 @@
     3.4  #define ia64_leave_kernel		__ia64_leave_kernel
     3.5  #define ia64_leave_syscall		__ia64_leave_syscall
     3.6  #define ia64_trace_syscall		__ia64_trace_syscall
     3.7 +#define ia64_ret_from_clone		__ia64_ret_from_clone
     3.8  #define ia64_switch_to			__ia64_switch_to
     3.9  #define ia64_pal_call_static		__ia64_pal_call_static
    3.10  
     4.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Wed Nov 22 09:30:27 2006 -0700
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Wed Nov 22 10:10:38 2006 -0700
     4.3 @@ -295,6 +295,7 @@ extern void xen_ptcga(unsigned long addr
     4.4  #define	ia64_leave_kernel		xen_leave_kernel
     4.5  #define	ia64_leave_syscall		xen_leave_syscall
     4.6  #define	ia64_trace_syscall		xen_trace_syscall
     4.7 +#define	ia64_ret_from_clone		xen_ret_from_clone
     4.8  #define	ia64_switch_to			xen_switch_to
     4.9  #define	ia64_pal_call_static		xen_pal_call_static
    4.10