svn commit: r212308 - head/sys/powerpc/aim
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Tue Sep 7 23:31:49 UTC 2010
Author: nwhitehorn
Date: Tue Sep 7 23:31:48 2010
New Revision: 212308
URL: http://svn.freebsd.org/changeset/base/212308
Log:
Fix an error made in r209975 related to context ID allocation for 64-bit
PowerPC CPUs running a 32-bit kernel. This bug could cause in-use VSIDs
to be allocated again to another process, causing memory space overlaps
and corruption.
Reported by: linimon
Modified:
head/sys/powerpc/aim/mmu_oea64.c
Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c Tue Sep 7 23:08:38 2010 (r212307)
+++ head/sys/powerpc/aim/mmu_oea64.c Tue Sep 7 23:31:48 2010 (r212308)
@@ -2108,7 +2108,7 @@ void
moea64_pinit(mmu_t mmu, pmap_t pmap)
{
int i;
- register_t hash;
+ uint32_t hash;
PMAP_LOCK_INIT(pmap);
@@ -2125,6 +2125,8 @@ moea64_pinit(mmu_t mmu, pmap_t pmap)
for (i = 0; i < 16; i++)
pmap->pm_sr[i] = VSID_MAKE(i, hash);
+
+ KASSERT(pmap->pm_sr[0] != 0, ("moea64_pinit: pm_sr[0] = 0"));
}
#endif
@@ -2238,6 +2240,8 @@ moea64_release_vsid(uint64_t vsid)
idx = vsid & (NVSIDS-1);
mask = 1 << (idx % VSID_NBPW);
idx /= VSID_NBPW;
+ KASSERT(moea64_vsid_bitmap[idx] & mask,
+ ("Freeing unallocated VSID %#jx", vsid));
moea64_vsid_bitmap[idx] &= ~mask;
mtx_unlock(&moea64_slb_mutex);
}
@@ -2254,10 +2258,9 @@ moea64_release(mmu_t mmu, pmap_t pmap)
free_vsids(pmap);
slb_free_user_cache(pmap->pm_slb);
#else
- if (pmap->pm_sr[0] == 0)
- panic("moea64_release: pm_sr[0] = 0");
+ KASSERT(pmap->pm_sr[0] != 0, ("moea64_release: pm_sr[0] = 0"));
- moea64_release_vsid(pmap->pm_sr[0]);
+ moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0]));
#endif
PMAP_LOCK_DESTROY(pmap);
More information about the svn-src-head
mailing list