Author: jhb Date: Fri May 10 16:32:44 2019 New Revision: 347435 URL: https://svnweb.freebsd.org/changeset/base/347435
Log: MFC 338957: Handle a guest executing a vm instruction by trapping and raising an undefined instruction exception. Previously we would exit the guest, however an unprivileged user could execute these. Modified: stable/11/sys/amd64/include/vmm.h stable/11/sys/amd64/vmm/intel/vmx.c stable/11/sys/amd64/vmm/vmm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/vmm.h ============================================================================== --- stable/11/sys/amd64/include/vmm.h Fri May 10 16:31:51 2019 (r347434) +++ stable/11/sys/amd64/include/vmm.h Fri May 10 16:32:44 2019 (r347435) @@ -544,6 +544,7 @@ enum vm_exitcode { VM_EXITCODE_MWAIT, VM_EXITCODE_SVM, VM_EXITCODE_REQIDLE, + VM_EXITCODE_VMINSN, VM_EXITCODE_MAX }; Modified: stable/11/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx.c Fri May 10 16:31:51 2019 (r347434) +++ stable/11/sys/amd64/vmm/intel/vmx.c Fri May 10 16:32:44 2019 (r347435) @@ -266,6 +266,9 @@ SDT_PROBE_DEFINE3(vmm, vmx, exit, monitor, SDT_PROBE_DEFINE3(vmm, vmx, exit, mwait, "struct vmx *", "int", "struct vm_exit *"); +SDT_PROBE_DEFINE3(vmm, vmx, exit, vminsn, + "struct vmx *", "int", "struct vm_exit *"); + SDT_PROBE_DEFINE4(vmm, vmx, exit, unknown, "struct vmx *", "int", "struct vm_exit *", "uint32_t"); @@ -2637,6 +2640,19 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ case EXIT_REASON_MWAIT: SDT_PROBE3(vmm, vmx, exit, mwait, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_MWAIT; + break; + case EXIT_REASON_VMCALL: + case EXIT_REASON_VMCLEAR: + case EXIT_REASON_VMLAUNCH: + case EXIT_REASON_VMPTRLD: + case EXIT_REASON_VMPTRST: + case EXIT_REASON_VMREAD: + case EXIT_REASON_VMRESUME: + case EXIT_REASON_VMWRITE: + case EXIT_REASON_VMXOFF: + case EXIT_REASON_VMXON: + SDT_PROBE3(vmm, vmx, exit, vminsn, vmx, vcpu, vmexit); + vmexit->exitcode = VM_EXITCODE_VMINSN; break; default: SDT_PROBE4(vmm, vmx, exit, unknown, Modified: stable/11/sys/amd64/vmm/vmm.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm.c Fri May 10 16:31:51 2019 (r347434) +++ stable/11/sys/amd64/vmm/vmm.c Fri May 10 16:32:44 2019 (r347435) @@ -1677,6 +1677,7 @@ restart: break; case VM_EXITCODE_MONITOR: case VM_EXITCODE_MWAIT: + case VM_EXITCODE_VMINSN: vm_inject_ud(vm, vcpuid); break; default: _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"