diff options
author | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2010-09-07 23:31:48 +0000 |
---|---|---|
committer | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2010-09-07 23:31:48 +0000 |
commit | 4982c539ae5f561ef3ad34af5938929f8548db63 (patch) | |
tree | 3369fb323f9f5f4f040bab1039a2124dce17e5e8 | |
parent | a64ee4e18fb5769bf00f77f335704f5f4e4c018a (diff) | |
download | src-4982c539ae5f561ef3ad34af5938929f8548db63.tar.gz src-4982c539ae5f561ef3ad34af5938929f8548db63.zip |
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
Notes
Notes:
svn path=/head/; revision=212308
-rw-r--r-- | sys/powerpc/aim/mmu_oea64.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index cc7f3878e922..c1b6f2c7b7e5 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -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); |