From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: [PATCH]: Fix syscall return code when ptrace or audit is active Date: Mon, 30 Jun 2008 16:08:58 +0200 Message-ID: <4868E8FA.4040701@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000809070303090503030005" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------000809070303090503030005 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------000809070303090503030005 Content-Type: text/x-patch; name="linux-2.6.18-xen-syscall-negative.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="linux-2.6.18-xen-syscall-negative.patch" 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) --------------000809070303090503030005 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------000809070303090503030005--