Date: Sat, 26 Jul 2014 02:51:46 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269108 - head/sys/amd64/vmm Message-ID: <201407260251.s6Q2pktD030374@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407260251.s6Q2pktD030374>