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. Found with: syzkaller Reviewed by: araujo, tychon (previous version) Approved by: re (kib) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D17192
This commit is contained in:
parent
d2f2e4c02d
commit
27d2645787
@ -557,6 +557,7 @@ enum vm_exitcode {
|
||||
VM_EXITCODE_SVM,
|
||||
VM_EXITCODE_REQIDLE,
|
||||
VM_EXITCODE_DEBUG,
|
||||
VM_EXITCODE_VMINSN,
|
||||
VM_EXITCODE_MAX
|
||||
};
|
||||
|
||||
|
@ -267,6 +267,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");
|
||||
|
||||
@ -2638,6 +2641,19 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
|
||||
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,
|
||||
vmx, vcpu, vmexit, reason);
|
||||
|
@ -1737,6 +1737,7 @@ restart:
|
||||
break;
|
||||
case VM_EXITCODE_MONITOR:
|
||||
case VM_EXITCODE_MWAIT:
|
||||
case VM_EXITCODE_VMINSN:
|
||||
vm_inject_ud(vm, vcpuid);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user