The Griotte project applies the Cerise formal-verification framework to CHERIoT, aiming to prove that compartment boundaries protect memory and prevent capabilities from being retained across calls. Built in Rocq using Iris separation logic, its methods verify known code against pre- and postconditions and model unknown, potentially malicious code through a general contract: code given only capabilities safe to share should remain confined to those capabilities. This lets proofs account for indirect access through shared memory and for restricted effects enabled by sealed cross-compartment calls. The researchers modeled CHERIoT’s compartment mechanisms and a simplified RTOS switcher, then extended the model to include exceptions, context switching, and optimisations. Their results support the overall design’s memory and stack safety, but assume firmware has already been correctly loaded; verifying the loader remains future work.
Extending the model exposed two switcher vulnerabilities. A malicious scheduler could revive an exited thread in a deprecated state, restoring access to a capability it should have lost. Separately, a malicious caller could exploit the stack high watermark (SHWM), which lets the switcher clear only the stack space used during a call. By arranging a stack pointer with restricted bounds and a stack object outside those bounds, the caller could make the switcher fault while returning before the callee’s stack was cleared, exposing private data. The proof failure revealed that the assumed SHWM invariant did not hold. The fix, merged as PR #799, prevents callers from changing the stack’s base. The work also highlights exception handling and optimisations as especially error-prone parts of the switcher, and demonstrates how formal proofs can uncover bugs in security-critical code.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.