[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH gnumach] pmap: Fix out of bounds mapwindow when using full NCPUS
From: |
Damien Zammit |
Subject: |
[PATCH gnumach] pmap: Fix out of bounds mapwindow when using full NCPUS |
Date: |
Sat, 05 Aug 2023 15:49:36 +0000 |
There are only two slots per cpu. Use only one of two per cpu.
---
i386/intel/pmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 0bb1a490..9bcbc279 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -1020,10 +1020,10 @@ pmap_mapwindow_t *pmap_get_mapwindow(pt_entry_t entry)
assert(entry != 0);
/* Find an empty one. */
- for (map = &mapwindows[cpu * PMAP_NMAPWINDOWS]; map <
&mapwindows[(cpu+1) * PMAP_NMAPWINDOWS]; map++)
+ for (map = &mapwindows[cpu]; map < &mapwindows[cpu+1 + NCPUS]; map +=
NCPUS)
if (!(*map->entry))
break;
- assert(map < &mapwindows[(cpu+1) * PMAP_NMAPWINDOWS]);
+ assert(map < &mapwindows[(cpu+1) + NCPUS]);
#ifdef MACH_PV_PAGETABLES
if (!hyp_mmu_update_pte(kv_to_ma(map->entry), pa_to_ma(entry)))
--
2.40.1
- [PATCH gnumach] pmap: Fix out of bounds mapwindow when using full NCPUS,
Damien Zammit <=