WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: Fix syscall return code when ptrace or audit is act

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]: Fix syscall return code when ptrace or audit is active
From: Chris Lalancette <clalance@xxxxxxxxxx>
Date: Mon, 30 Jun 2008 16:08:58 +0200
Delivery-date: Mon, 30 Jun 2008 07:10:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080501)
Attached is a simple patch to fix the return value from the 64-bit kernel when
you call with a bad system call number with tracing enabled (for either ptrace
or audit).  What should happen is that the user process gets a -ENOSYS return
call from the syscall; what actually happens (only in the 64-bit kernel) is that
you get back the system call number.  The 32-bit kernel does not suffer from
this bug, and the pv-ops implementation in the upstream Linux kernel also does
not have this bug.  The attached patch makes the tracesys path look the same as
it does in upstream Linux, and ensures that we return -ENOSYS on this path.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
diff -r b29a06ba7a5f arch/x86_64/kernel/entry-xen.S
--- a/arch/x86_64/kernel/entry-xen.S    Fri Jun 27 16:07:56 2008 +0100
+++ b/arch/x86_64/kernel/entry-xen.S    Mon Jun 30 15:23:56 2008 +0200
@@ -334,12 +334,11 @@ tracesys:
        LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed 
it */
        RESTORE_REST
        cmpq $__NR_syscall_max,%rax
-       ja  1f
+       ja  int_ret_from_sys_call
        movq %r10,%rcx  /* fixup for C */
        call *sys_call_table(,%rax,8)
-1:     movq %rax,RAX-ARGOFFSET(%rsp)
+       movq %rax,RAX-ARGOFFSET(%rsp)
        /* Use IRET because user could have changed frame */
-       jmp int_ret_from_sys_call
        CFI_ENDPROC
 END(system_call)
                
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>