Page MenuHomeFreeBSD

Fix arm64's pmap_enter_quick_locked()
ClosedPublic

Authored by alc on Sep 29 2019, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 11:46 PM
Unknown Object (File)
Nov 23 2024, 9:01 AM
Unknown Object (File)
Nov 22 2024, 4:57 PM
Unknown Object (File)
Oct 2 2024, 7:48 AM
Unknown Object (File)
Sep 30 2024, 11:25 PM
Unknown Object (File)
Sep 27 2024, 12:45 AM
Unknown Object (File)
Sep 26 2024, 1:26 PM
Unknown Object (File)
Sep 23 2024, 9:18 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

Lint
Lint Skipped
Unit
Tests Skipped