svn commit: r365777 - in stable: 11/sys/amd64/vmm/amd 11/sys/amd64/vmm/intel 12/sys/amd64/vmm/amd 12/sys/amd64/vmm/intel
Ed Maste
emaste at FreeBSD.org
Tue Sep 15 21:28:48 UTC 2020
Author: emaste
Date: Tue Sep 15 21:28:47 2020
New Revision: 365777
URL: https://svnweb.freebsd.org/changeset/base/365777
Log:
MFC r365775: bhyve: do not permit write access to VMCB / VMCS
Reported by: Patrick Mooney
Submitted by: jhb
Security: CVE-2020-24718
Modified:
stable/12/sys/amd64/vmm/amd/svm.c
stable/12/sys/amd64/vmm/intel/vmx.c
Directory Properties:
stable/12/ (props changed)
Changes in other areas also in this revision:
Modified:
stable/11/sys/amd64/vmm/amd/svm.c
stable/11/sys/amd64/vmm/intel/vmx.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/12/sys/amd64/vmm/amd/svm.c
==============================================================================
--- stable/12/sys/amd64/vmm/amd/svm.c Tue Sep 15 21:07:30 2020 (r365776)
+++ stable/12/sys/amd64/vmm/amd/svm.c Tue Sep 15 21:28:47 2020 (r365777)
@@ -2205,8 +2205,11 @@ svm_setreg(void *arg, int vcpu, int ident, uint64_t va
return (svm_modify_intr_shadow(svm_sc, vcpu, val));
}
- if (vmcb_write(svm_sc, vcpu, ident, val) == 0) {
- return (0);
+ /* Do not permit user write access to VMCB fields by offset. */
+ if (!VMCB_ACCESS_OK(ident)) {
+ if (vmcb_write(svm_sc, vcpu, ident, val) == 0) {
+ return (0);
+ }
}
reg = swctx_regptr(svm_get_guest_regctx(svm_sc, vcpu), ident);
Modified: stable/12/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- stable/12/sys/amd64/vmm/intel/vmx.c Tue Sep 15 21:07:30 2020 (r365776)
+++ stable/12/sys/amd64/vmm/intel/vmx.c Tue Sep 15 21:28:47 2020 (r365777)
@@ -3324,6 +3324,10 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val)
if (vmxctx_setreg(&vmx->ctx[vcpu], reg, val) == 0)
return (0);
+ /* Do not permit user write access to VMCS fields by offset. */
+ if (reg < 0)
+ return (EINVAL);
+
error = vmcs_setreg(&vmx->vmcs[vcpu], running, reg, val);
if (error == 0) {
More information about the svn-src-all
mailing list