lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231023203531.2461809-1-seanjc@google.com>
Date:   Mon, 23 Oct 2023 13:35:31 -0700
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Binbin Wu <binbin.wu@...ux.intel.com>,
        Sean Christopherson <seanjc@...gle.com>
Subject: [PATCH gmem] KVM: Fix off-by-one error when querying attributes in xarray

Subtract -1 from kvm_range_has_memory_attributes()'s @end when using
xas_find(), as "end" is exclusive whereas xas_find() takes an inclusive
"max" as the maximal index to find/return.

Reported-by: Binbin Wu <binbin.wu@...ux.intel.com>
Signed-off-by: Sean Christopherson <seanjc@...gle.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 959e866c84f0..12458959dd25 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2447,7 +2447,7 @@ bool kvm_range_has_memory_attributes(struct kvm *kvm, gfn_t start, gfn_t end,
 	rcu_read_lock();
 
 	if (!attrs) {
-		has_attrs = !xas_find(&xas, end);
+		has_attrs = !xas_find(&xas, end - 1);
 		goto out;
 	}
 

base-commit: 911b515af3ec5f53992b9cc162cf7d3893c2fbe2
-- 
2.42.0.758.gaed0368e0e-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ