forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[prover] escape analysis to detect leaks of module-internal references
This is an experimental analysis used in an upcoming paper on robust safety for Move. The high-level idea is that: - We have an abstract "prover" that can show that invariants hold locally within a module: i.e., if you assume `i` holds in the precondition of every public function of a module, the prover can establish when `i` also holds in the postcondition of the function. The Move Prover is a concrete instantiation of this abstract tool, but other instantiations are possible. - We have an abstract "encapsulator" that can establish when module-local invariants are also global invariants (i.e., hold in every possible program execution, even when the module in question interacts with untrusted code). The analysis in this PR is a concrete instantiation of this abstract tool, but other instantiations are possible. - When both the prover and the encapsulator approve a (module, `i`) pair, we can establish that `i` holds globally. If the encapsulator says no, there may be an attack where untrusted code can violate `i`. The encapsulator implementation is an escape analysis that detects when a procedure "leaks" mutable references that point inside of structs declared in the current module. An attacker can use such a reference to violate local invariants that involve the leaked memory. The PR implements the analysis + tests and adds several utility functions in move-model useful for running the analysis on benchmarks and collecting stats. It reports nothing in the Diem Framework and flags only the `Option::borrow_mut` code in the Move stdlib. This procedure does indeed leak an internal mutable reference, but the reference cannot be used to violate any invariants of the `Option` module. Closes: aptos-labs#8807
- Loading branch information
1 parent
6ac55b7
commit 03c30e1
Showing
23 changed files
with
2,078 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.