guarantees around panics and crashes #80
Replies: 1 comment 1 reply
-
A few notes (slightly ramble-y, sorry):
At a high-level, all of this tells us that Let us now (hypothetically) consider a world where we force How bad do things get? Given that we can verify the absence of many kinds of panics, I would argue, not too terrible. Arith overflows, out-of-bounds indexing, etc. are some of the most common causes for panics, and those are all verified to not exist, so we are already in a less-panicky world. For situations where a For custom hand-made OOM-errors and such are uncatchable panics anyways, so don't play a role in this discussion. All of this evidence seemingly points us towards: simply disallow both Are there situations where we necessarily need to use unwind-panics and Side note: there is a compiled-binary-size and also (small but non-trivial) runtime speed advantage to On the Rust side of things, there is a useful crate no-panic to prove the absence of panics. (Also see panic-never and dont_panic). With Non-panic aborts (stuff we should probably rule out of scope): of course, there is the OOM-based process killing as Travis mentioned; also uncatchable signals like |
Beta Was this translation helpful? Give feedback.
-
Panics in Rust
To provide a guarantee, it's important to distinguish the various types of panics that can occur in a Rust program. Let's start with the facts about Rust:
RefCell
catch_unwind
.panic=abort
to force all panics to be aborts, which means unwinding is impossible. He also points out that unwinding is completely impossible on some architectures.Implications for Verus
Now, when verification comes into the picture:
malloc
succeeds would require complex resource management. Our previous projects didn't attempt to verify this sort of thing (although some of them used statically allocated memory, which would have made this trivial). E.g., VeriBetrKV's specification implicitly allowed for crashes on out-of-memory, and didn't make any kind of guarantee like, "will definitely succeed if given XX memory".RefCell
. A user might use our replacements (likePCell
) which does not panic, and whose used are verified; but a different user might be willing to accept the possibility of panics.Verus's guarantees?
Although this was a lot of information, I think it all points towards a fairly simple takeaway for Verus's guarantees.
#[verifier(may_unwind)]
for more flexibility.Beta Was this translation helpful? Give feedback.
All reactions