Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2016 00:05:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-amd64@FreeBSD.org
Subject:   [Bug 208168] Bad KASSERT in vmm.c vm_gpa_hold()
Message-ID:  <bug-208168-6@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D208168

            Bug ID: 208168
           Summary: Bad KASSERT in vmm.c vm_gpa_hold()
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: daverabbitz@ihug.co.nz
                CC: freebsd-amd64@FreeBSD.org
                CC: freebsd-amd64@FreeBSD.org

The KASSERT in this function is always true for positive values of vcpuid, =
it
looks like it is intended to check vcpuid is in the range -1 to VM_MAXCPU.

Here is a patch to make it right:

diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index cb04f3c..ebd6360 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -914,7 +914,7 @@ vm_gpa_hold(struct vm *vm, int vcpuid, vm_paddr_t gpa,
size_t len, int reqprot,
         * guaranteed if at least one vcpu is in the VCPU_FROZEN state.
         */
        int state;
-       KASSERT(vcpuid >=3D -1 || vcpuid < VM_MAXCPU, ("%s: invalid vcpuid =
%d",
+       KASSERT(vcpuid >=3D -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid =
%d",
            __func__, vcpuid));
        for (i =3D 0; i < VM_MAXCPU; i++) {
                if (vcpuid !=3D -1 && vcpuid !=3D i)

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-208168-6>