-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address caprevoke consistency check failures #2221
base: dev
Are you sure you want to change the base?
Commits on Sep 13, 2024
-
caprevoke: Make assertions in pmap_assert_consistent_clg() more useful
Print the PTE as well, since the debugger isn't able to retrieve it. While here, remove an XXX comment in the arm64 implementation: pmap_pte() returns NULL if the address is not mapped, which is a perfectly ordinary state of affairs.
Configuration menu - View commit details
-
Copy full SHA for bdccaec - Browse repository at this point
Copy the full SHA bdccaecView commit details -
arm64: Preserve ATTR_SC when demoting l3c mappings
If any entry in a L3C mapping has ATTR_SC set (i.e., it is cap-dirty), the flag must be propagated to all other entries when demoting.
Configuration menu - View commit details
-
Copy full SHA for c2793d5 - Browse repository at this point
Copy the full SHA c2793d5View commit details -
arm64: Remove an unneeded check in pmap_promote_l2()
We don't need to check each PTE: we already verify that the first PTE in the run does not have CDBM set and SC clear, and in the loop we check that the PTEs are identical in virtually all attributes. No functional change intended.
Configuration menu - View commit details
-
Copy full SHA for d6090d3 - Browse repository at this point
Copy the full SHA d6090d3View commit details -
arm64: Avoid promoting L3C runs CDBM-set SC-clear PTEs
As in pmap_promote_l2(), we should avoid promotion if the mapping allows capability stores but is not yet capability-dirty.
Configuration menu - View commit details
-
Copy full SHA for 1aa35d7 - Browse repository at this point
Copy the full SHA 1aa35d7View commit details -
arm64: Demote L2 and L3C mappings in pmap_caploadgen_update()
Previously, pmap_caploadgen_update() would return PMAP_CAPLOADGEN_UNABLE, which is overloaded to cover the case where no mapping exists at all. In this case, the MI machinery will look up the page via the VM object and scan it. If the 4KB page contains capabilities, vm_fault() is called upon to scan the page and update the pmap, which breaks the large mapping as a side effect. However, if the page is capability-clean, the large mapping will not be demoted, and during a background scan the subsequent pmap_caploadgen_update() will fail to update the CLG in the L2 or L3C PTE. Thus, the scan will end with some PTEs carrying the wrong CLG. When the GCLG is incremented during a subsequent scan, the kernel may fail to interpose load-cap operations from that mapping, which could potentially allow revoked capabilities to be leaked. Fix the problem by demoting the mapping as soon as it is encountered. This is not optimal (we end up demoting clean superpage mappings), but it fixes the problem of overloading PMAP_CAPLOADGEN_UNABLE and removes an assumption about pmap_enter()'s behaviour (i.e., that it'll demote L2 and L3C mappings), and pmap_caploadgen_update() already reconstructs superpage mappings when possible. L1 largepage mappings are left unhandled for now.
Configuration menu - View commit details
-
Copy full SHA for 76a160e - Browse repository at this point
Copy the full SHA 76a160eView commit details -
arm64: Rebuild ATTR_CONTIGUOUS mappings in pmap_caploadgen_update()
The background scan opportunistically rebuilds L2 superpage mappings. Do the same for L3C mappings. Re-enable creation of read-only L3C mappings in pmap_enter_l3c(). Since that commit appeared, upstream has implemented L3C promotion, and pmap_caploadgen_update() now handles L3C mappings by demoting rather than going through the fault handler.
Configuration menu - View commit details
-
Copy full SHA for 61c10d0 - Browse repository at this point
Copy the full SHA 61c10d0View commit details -
caprevoke: Improve the vm_cheri_assert_consistent_clg() check
- Use a sysctl to enable it, rather than requiring it be configured at compile-time - Skip over map entries that definitely do not contain capabilities, including the quarantine bitmap (OBJ_NOCAP)
Configuration menu - View commit details
-
Copy full SHA for 6bdce98 - Browse repository at this point
Copy the full SHA 6bdce98View commit details -
caprevoke: Avoid validating CLGs if revocation is in progress
When forking, the GCLG and LCLGs may be out of sync if a new revocation epoch was opened (bumping the GCLG) but the background scan has not yet started (background scans block fork()). This can arise if a cheri_revoke() is called without either of the CHERI_REVOKE_LAST_PASS and CHERI_REVOKE_ASYNC flags.
Configuration menu - View commit details
-
Copy full SHA for 903f7a6 - Browse repository at this point
Copy the full SHA 903f7a6View commit details -
caprevoke: Fix a buggy vm_cheri_assert_consistent_clg() call
vm_cheri_assert_consistent_clg() must be called with the VM map lock held. Also make sure to only call it after the epoch is closed, i.e., we have set the revocation state to CHERI_REVOKE_ST_NONE.
Configuration menu - View commit details
-
Copy full SHA for 6afefbc - Browse repository at this point
Copy the full SHA 6afefbcView commit details