Page MenuHomeFreeBSD

Fix arm64's pmap_enter_quick_locked()
ClosedPublic

Authored by alc on Sep 29 2019, 6:05 PM.
Tags
None
Referenced Files
F167490872: D21841.id62712.diff
Sat, Aug 22, 5:51 AM
F167419139: D21841.diff
Fri, Aug 21, 3:36 PM
Unknown Object (File)
Mon, Aug 17, 10:54 PM
Unknown Object (File)
Sat, Aug 15, 8:06 AM
Unknown Object (File)
Fri, Aug 14, 10:03 AM
Unknown Object (File)
Wed, Aug 12, 1:30 AM
Unknown Object (File)
Tue, Aug 11, 6:57 PM
Unknown Object (File)
Sun, Aug 9, 9:47 AM
Subscribers

Details

Summary

When arm64's pmap_enter_quick_locked() creates a user-space mapping, it doesn't set ATTR_AP(ATTR_AP_USER) in the PTE, so any subsequent attempt to read from the page triggers a page fault.

This problem isn't fatal because the page fault handler will determine that the mapping should be valid and perform a pmap_enter() that sets ATTR_AP(ATTR_AP_USER) in the new PTE.

That said, I do believe that instruction fetches are not affected by this bug. (See Table D5-33 in the architecture manual.) In other words, as long as the mapping doesn't have ATTR_XN set, user-space instruction fetches will succeed even without ATTR_AP(ATTR_AP_USER) in the PTE.

Test Plan

Clang reads source files using mmap(). Before applying this patch, vmstat -s reported "235989057 total VM faults taken" after a "buildworld". After applying the patch, vmstat -s reported "190243137 total VM faults taken".

I'm double-checking these numbers, because the difference is more than I would have guessed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable