Page MenuHomeFreeBSD

powerpc/radix: acquire the pmap lock in mmu_radix_extract()
ClosedPublic

Authored by pkubaj on Wed, Sep 2, 9:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 26, 12:34 PM
Unknown Object (File)
Thu, Sep 24, 12:31 AM
Unknown Object (File)
Wed, Sep 23, 11:09 AM
Unknown Object (File)
Mon, Sep 21, 7:54 AM
Unknown Object (File)
Sun, Sep 20, 1:19 PM
Unknown Object (File)
Sat, Sep 19, 1:29 PM
Unknown Object (File)
Sat, Sep 19, 4:27 AM
Unknown Object (File)
Fri, Sep 18, 3:36 PM
Subscribers

Details

Summary

mmu_radix_extract() walks the page tables without holding the pmap lock,
unlike its hash MMU counterpart moea64_extract(). A concurrent unmap can
free and recycle the page table page being walked, so the read returns
whatever now occupies that memory and the caller gets a physical address
that never existed.

That is how mmu_radix_sync_icache() came to hand a bogus address to
__syncicache() and panic the machine. Commit 1574ca1955f5 worked around
it by taking the pmap lock in mmu_radix_sync_icache(), but the machine
independent callers of pmap_extract() - vm_sync_icache(), proc_rwmem()
and the vslock() paths - remain exposed to the same failure.

Rename the existing body to mmu_radix_extract_locked(), which asserts the
lock, and make mmu_radix_extract() a thin wrapper that acquires it.
mmu_radix_sync_icache() already holds the pmap lock, so it calls the
locked variant directly and neither recurses nor reacquires the lock once
per page.

Suggested by: alc

MFC after: 1 week

Test Plan

POWER9 (radix MMU), GENERIC64LE kernel built from main.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable