From owner-svn-src-all@FreeBSD.ORG Sat Jul 26 02:51:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BDA63910; Sat, 26 Jul 2014 02:51:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AABFC2902; Sat, 26 Jul 2014 02:51:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6Q2pknA030375; Sat, 26 Jul 2014 02:51:46 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6Q2pktD030374; Sat, 26 Jul 2014 02:51:46 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201407260251.s6Q2pktD030374@svn.freebsd.org> From: Neel Natu Date: Sat, 26 Jul 2014 02:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269108 - head/sys/amd64/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2014 02:51:46 -0000 Author: neel Date: Sat Jul 26 02:51:46 2014 New Revision: 269108 URL: http://svnweb.freebsd.org/changeset/base/269108 Log: Don't return -1 from the push emulation handler. Negative return values are interpreted specially on return from sys_ioctl() and may cause undesirable side-effects like restarting the system call. Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- head/sys/amd64/vmm/vmm_instruction_emul.c Sat Jul 26 02:41:18 2014 (r269107) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Sat Jul 26 02:51:46 2014 (r269108) @@ -781,10 +781,17 @@ emulate_push(void *vm, int vcpuid, uint6 error = vm_copy_setup(vm, vcpuid, paging, stack_gla, size, PROT_WRITE, copyinfo, nitems(copyinfo)); - if (error == -1) - return (-1); /* Unrecoverable error */ - else if (error == 1) - return (0); /* Return to guest to handle page fault */ + if (error == -1) { + /* + * XXX cannot return a negative error value here because it + * ends up being the return value of the VM_RUN() ioctl and + * is interpreted as a pseudo-error (for e.g. ERESTART). + */ + return (EFAULT); + } else if (error == 1) { + /* Resume guest execution to handle page fault */ + return (0); + } error = memread(vm, vcpuid, mmio_gpa, &val, size, arg); if (error == 0) {