svn commit: r269108 - head/sys/amd64/vmm
Neel Natu
neel at FreeBSD.org
Sat Jul 26 02:51:46 UTC 2014
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) {
More information about the svn-src-head
mailing list