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)
Sat, Apr 13, 3:48 PM
Unknown Object (File)
Dec 22 2023, 10:26 PM
Unknown Object (File)
Dec 19 2023, 5:46 PM
Unknown Object (File)
Nov 14 2023, 8:32 PM
Unknown Object (File)
Nov 12 2023, 12:10 AM
Unknown Object (File)
Jul 13 2023, 3:32 AM
Unknown Object (File)
May 23 2023, 7:01 AM
Unknown Object (File)
May 18 2023, 9:24 PM
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