From d7b40b493097c87910a5c1cf1316bb7c4be5bafd Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Tue, 31 Aug 2021 15:07:01 +0000 Subject: 14042 GPT: Closed ranges conflict with other code causing panics Reviewed by: Patrick Mooney Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/i86pc/io/vmm/vmm_gpt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr/src/uts/i86pc/io/vmm/vmm_gpt.c b/usr/src/uts/i86pc/io/vmm/vmm_gpt.c index 6624e0fa6d..9f6cc44aac 100644 --- a/usr/src/uts/i86pc/io/vmm/vmm_gpt.c +++ b/usr/src/uts/i86pc/io/vmm/vmm_gpt.c @@ -359,12 +359,12 @@ vmm_gpt_populate_entry(vmm_gpt_t *gpt, uint64_t gpa) /* * Ensures that PTEs for the region of address space bounded by - * [start, end] exist in the tree. + * [start, end) exist in the tree. */ void vmm_gpt_populate_region(vmm_gpt_t *gpt, uint64_t start, uint64_t end) { - for (uint64_t page = start; page <= end; page += PAGESIZE) { + for (uint64_t page = start; page < end; page += PAGESIZE) { vmm_gpt_populate_entry(gpt, page); } } @@ -451,13 +451,13 @@ vmm_gpt_vacate_entry(vmm_gpt_t *gpt, uint64_t gpa) /* * Cleans up the unused inner nodes in the GPT for a region of guest - * physical address space bounded by `start` and `end`. The region - * must map no pages. + * physical address space bounded by [start..end). The region must + * map no pages. */ void vmm_gpt_vacate_region(vmm_gpt_t *gpt, uint64_t start, uint64_t end) { - for (uint64_t page = start; page <= end; page += PAGESIZE) { + for (uint64_t page = start; page < end; page += PAGESIZE) { vmm_gpt_vacate_entry(gpt, page); } } @@ -488,14 +488,14 @@ vmm_gpt_unmap(vmm_gpt_t *gpt, uint64_t gpa) /* * Un-maps the region of guest physical address space bounded by - * start and end. Returns the number of pages that are unmapped. + * [start..end). Returns the number of pages that are unmapped. */ size_t vmm_gpt_unmap_region(vmm_gpt_t *gpt, uint64_t start, uint64_t end) { size_t n = 0; - for (uint64_t page = start; page <= end; page += PAGESIZE) { + for (uint64_t page = start; page < end; page += PAGESIZE) { if (vmm_gpt_unmap(gpt, page) != 0) n++; } -- cgit v1.2.3