Live data from Hacker News

Verus: Verified Rust for low-level systems code

github.com

31–40 of 53 posts

Re: Verus: Verified Rust for low-level systems code

#31
post #18

Would it be better to build dependent types into the language itself so that we can guarantee any spec we want? Or do these tools have some advantage over dependent typing?

I am not aware of a viable "dependent type system". Such ones as we have are very complicated and not generally a good engineering trade off.

It is The Dream in some ways, but it is much, much easier said than done.

Re: Verus: Verified Rust for low-level systems code

#32
post #18

Would it be better to build dependent types into the language itself so that we can guarantee any spec we want? Or do these tools have some advantage over dependent typing?

From glancing at https://www.andrew.cmu.edu/user/bparno/papers/verus-ghost.pd... it is more related than you think. - The various "modes" are going to be needed either way, because side-effectful functions at the type level are a research problem that probably isn't worth the effort. - The in the pure functional "promotable" fragment, it probably also makes sense to relax aliasing rules / have infinite number types /…

Oh wow, that's incredibly cool. (tldr: the authors of Verus, mostly university researchers, are already thinking in this direction).

I think having guardrails like this is going to incredibly important as AI code gen starts taking a bigger role. Hopefully, as a separate comment mentioned, there can be a standard created so that AI tools can learn it more easily.

Re: Verus: Verified Rust for low-level systems code

#33

How does it differ from Prusti and Creusot? I feel, with more and more tools crowding that space, a common specification language would make sense. Sure, every tool has its own unique selling points but there is considerable overlap. For example, if all I want is to express that I expect a function not to panic, there should be one syntax that works with all tools.

[deleted]

Re: Verus: Verified Rust for low-level systems code

#34
post #15
post #11

Earlier quoted context omitted.

A common specification language is a very ongoing discussion, we just haven't managed to find an agreement yet. Things like `#[no_panic]` make sense, but it also doesn't require a spec language at all, the compiler already has support for these kinds of annotation and anyone could catch it. Though I cannot think of a single verification use case where all I want to check is the absence of panic.

> single verification use case where all I want to check is the absence of panic. Basically any decoder/deserializer. It might be sufficient to handle the correctness in tests but panics are the most severe thing you want to avoid. How well `#[no_panic]` actually works in practice? There might be cases where e.g. index access violation never happen but compiler might still think that it happes. I could be impossible…

#[no_panic] has false-positives, but no false-negatives. If it’s present, the code won’t panic and can’t panic.

Index access violation that “never happens” is the root of every buffer overflow, so I’m absolutely OK with the minimal overhead behind the bounds check for actual safety

Re: Verus: Verified Rust for low-level systems code

#35

Earlier quoted context omitted.

Yes, but remember that Erlang bug discussed here last week where somebody apparently messed up SSH state transitions in such a way that people could just log in without having the password or anything? Buffer overflows etc. are absurd things that should not be possible, but preventing them is the first step towards security.

This is something that Rust should prevent, not another layer on top of Rust.

[deleted]

Re: Verus: Verified Rust for low-level systems code

#36

Earlier quoted context omitted.

Yes, but remember that Erlang bug discussed here last week where somebody apparently messed up SSH state transitions in such a way that people could just log in without having the password or anything? Buffer overflows etc. are absurd things that should not be possible, but preventing them is the first step towards security.

This is something that Rust should prevent, not another layer on top of Rust.

Buffer overflow vulnerabilities are prevented with bounds checking, but that just means you get a panic at runtime. With formal verification, you can prove that the program never accesses an array with an index that's out of bounds.

I guess you're asking why that wasn't built into Rust from the start; after all, there are programming languages with the formal verification and theorem-proving built-in, e.g. for imperative languages, the SPARK extension to Ada, as well as ATS, or for a functional one, Idris. My guess is that Rust never would have become popular if you needed to write actual formal proofs to guarantee some degree of safety, since satisfying the borrow checker is easier in comparison, and it also probably would have been a lot harder to develop Rust after that. The borrow checker simply eliminating use-after-free errors and data races in safe code was good enough.

Re: Verus: Verified Rust for low-level systems code

#37
post #31
post #18

Would it be better to build dependent types into the language itself so that we can guarantee any spec we want? Or do these tools have some advantage over dependent typing?

I am not aware of a viable "dependent type system". Such ones as we have are very complicated and not generally a good engineering trade off. It is The Dream in some ways, but it is much, much easier said than done.

We've head them for 20 years. Lean is getting a lot of attention. Dependent types are not very complicate --- proofs are very complicated, but that is inherent. Dependent types are "only pay for what you prove" --- if you don't try to prove anything there is no problem.

Re: Verus: Verified Rust for low-level systems code

#38
post #24

Earlier quoted context omitted.

I think the current plan is to integrate never-panic into the upcoming effect system (formerly keyword generics), along with const and async. So all these function annotations can share the same behavior and syntax, and higher order functions can be generic over them (e.g. "iterator.map(f) is never-panic if f is never-panic" etc)

> effect system (formerly keyword generics) Any recent link about that? Specially one that calls it effect system rather than the old name keyword generics

Here's a semi-recent link (~a year ago) by one of the leaders of this initiative: https://blog.yoshuawuyts.com/extending-rusts-effect-system/

Re: Verus: Verified Rust for low-level systems code

#39

Earlier quoted context omitted.

Why is verification excessive but not tests? A verification of a property is stronger than a mere test of a property.

The test is supposed to be the verification.

Say I have as input a byte. I create a test that exercises every possible byte value.

A verification would be the equivalent of that. In practice that matters since the input space is often much larger than just one byte.

Re: Verus: Verified Rust for low-level systems code

#40
post #18

Would it be better to build dependent types into the language itself so that we can guarantee any spec we want? Or do these tools have some advantage over dependent typing?

My feeling is that dependent types add complexity to a language that's already well-known for having a complex type system, so I'm nervous about blowing the complexity budget. But I'm bullish on tools like Verus, Prusti, and Creusot because they allow people who need to write low-level unsafe code to prove their code safe, while keeping the complexity of the safety proofs localized to that code, so most Rust programmers don't need to worry about it. This allows verification of Rust code without surfacing complexity to most developers. We can have our cake and eat it too.
Post reply on HN