diff options
author | neel <neel@FreeBSD.org> | 2014-07-26 02:51:46 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-07-26 02:51:46 +0000 |
commit | 62d591cec94c248df911d92a4fe25355d10f687f (patch) | |
tree | 30a1fc7a08b56a5ce4fa7b66b47b103f6bf74ba5 /sys/amd64/vmm | |
parent | 4cf4c54868b8f97ec320ad61818f8ea318723a49 (diff) | |
download | FreeBSD-src-62d591cec94c248df911d92a4fe25355d10f687f.zip FreeBSD-src-62d591cec94c248df911d92a4fe25355d10f687f.tar.gz |
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.
Diffstat (limited to 'sys/amd64/vmm')
-rw-r--r-- | sys/amd64/vmm/vmm_instruction_emul.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c index b145f69..2e77ece 100644 --- a/sys/amd64/vmm/vmm_instruction_emul.c +++ b/sys/amd64/vmm/vmm_instruction_emul.c @@ -781,10 +781,17 @@ emulate_push(void *vm, int vcpuid, uint64_t mmio_gpa, struct vie *vie, 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) { |