News for hackers. Stuff that matters.
Re:Hardening attack surfaces with formally proven binary for... by dataangel on Monday July 04, 2022 @12:10AM (#31973403)
I find it very impressive that the work actually made it into the Windows kernel. AFAIK the Linux kernel doesn't have formally verified parsers for any of the wire formats it deals with, this seems like an improvement on actually-in-use-outside-the-lab state of the art.
Re:Hardening attack surfaces with formally proven binary for... by tonmoy on Monday July 04, 2022 @06:35AM (#31975570)
This is not new for MS. Windows 98 and XP would get a lot of BSOD because of third party drivers doing illegal things. MS have been investing heavily in formal verification since early 2000s because of that. My master’s adviser (and many more professors working in formal verification) would get most of their funding from MS. One early successful example I can think of is SLAM[1]

1. https://www.microsoft.com/en-us/research/project/slam/

Re:Hardening attack surfaces with formally proven binary for... by staticassertion on Monday July 04, 2022 @02:12PM (#31980145)
Also, P. https://www.microsoft.com/en-us/research/blog/p-programming-...

> P got its start in Microsoft software development when it was used to ship the USB 3.0 drivers in Windows 8.1 and Windows Phone

Re:Hardening attack surfaces with formally proven binary for... by bestouff on Monday July 04, 2022 @05:06AM (#31975040)
Linux will probably get some Rust parsers in the future, which are IMHO even better because they are easy to write so you're sure they are robust - whereas formally verifying a parser may or may not be done depending on the coder's available time and willingness to do so.
Re:Hardening attack surfaces with formally proven binary for... by mbrodersen on Monday July 04, 2022 @05:39AM (#31975239)
Rust doesn’t stop you from writing buggy code. However I do agree that it is easier to write memory safe code in Rust compared with C/C++.
Re:Hardening attack surfaces with formally proven binary for... by masklinn on Monday July 04, 2022 @07:38AM (#31975935)
TBF lots of formal tools don’t either, because you still have to translate the proven code by hand.

It looks like Microsoft’s does the translation, so the only risk is bugs in the code generator, which seems nice.

There’s also Google’s wuffs, but I don’t think that is formal, it just ensures memory safety.

Re:Hardening attack surfaces with formally proven binary for... by jnash on Tuesday July 05, 2022 @12:39AM (#31984371)
Yep if the translation is done by hand then that might be a potential problem. However a lot of modern proof tools have proven correct translators (based on the CompCert work).
Re:Hardening attack surfaces with formally proven binary for... by staticassertion on Monday July 04, 2022 @02:10PM (#31980123)
No amount of formal verification stops you from writing buggy code.
Re:Hardening attack surfaces with formally proven binary for... by jnash on Tuesday July 05, 2022 @12:40AM (#31984375)
I don't think you understand what "proven correct" means. If you formally prove a spec correct using modern proof tools then it is guaranteed to have zero bugs. Nobody has found even a single bug in the proven correct CompCert C compiler for example. However people find bugs in gcc all the time.
Re:Hardening attack surfaces with formally proven binary for... by staticassertion on Tuesday July 05, 2022 @01:09AM (#31984543)
It means that a program has been verified against a model, and properties of that model are held true.

What it does not mean is that the program is bug free. That would, of course, violate the halting problem, or its generalization Rice's Theorem - non-trivial programs can not have arbitrary properties proven about them.

There's also Gödel's Incompleteness Theorem, obviously, as well as the fact that a proof is only as good as its model.

Re:Hardening attack surfaces with formally proven binary for... by UncleMeat on Tuesday July 05, 2022 @11:53AM (#31989769)
It wouldn’t break Rice’s Thm to prove it for a particular program. All Rice’s Thm says is that any algorithm must fail on some programs.
Re:Hardening attack surfaces with formally proven binary for... by staticassertion on Tuesday July 05, 2022 @09:27PM (#31995775)
It would if you're talking about arbitrary classes of bugs.
Re:Hardening attack surfaces with formally proven binary for... by UncleMeat on Tuesday July 05, 2022 @09:56PM (#31995929)
Not so. Consider the algorithm that reports "Yes" for all inputs for all program properties. For a large number of programs and properties, this algorithm will report the correct information.
Re:Hardening attack surfaces with formally proven binary for... by mbrodersen on Tuesday July 05, 2022 @09:19PM (#31995728)
Not true for non-Turing complete languages. Which is why all proof tools require a proof of termination. Some do it automatically (essential ruling out Turing complete languages) others require a formal proof of termination by the user.
Re:Hardening attack surfaces with formally proven binary for... by UncleMeat on Tuesday July 05, 2022 @11:52AM (#31989752)
Ages ago my advisor had a paper proving WEP to be correct. Many years later, a serious flaw was discovered.

Even formal verification can be insufficient.

Re:Hardening attack surfaces with formally proven binary for... by mbrodersen on Tuesday July 05, 2022 @09:20PM (#31995734)
Was it a proof by hand or using a formal proof tool? Never trust proofs that aren’t formally verified by a modern proof tool.
Re:Hardening attack surfaces with formally proven binary for... by UncleMeat on Tuesday July 05, 2022 @09:57PM (#31995934)
Formal verification with model checking.
Re:Hardening attack surfaces with formally proven binary for... by mbrodersen on Wednesday July 06, 2022 @08:51PM (#32008742)
That frankly sounds hard to believe. Which proof tool did he use? Link to paper?
Re:Hardening attack surfaces with formally proven binary for... by 0x69420 on Monday July 04, 2022 @10:42AM (#31977580)
f* (one system on display in this paper) can extract to c/assembler suitable for inclusion in a hand-written c source tree, all the while giving a wider and more interesting set of guarantees with the added benefit that you won't have to depend on a rust toolchain to build your project (bootstrapping f* is considerably easier, and you only have to do it when you check in your verified bits)

funny enough, much like rust, one of its most widely-deployed applications lives in firefox; see project-everest.github.io

Re:Hardening attack surfaces with formally proven binary for... by UncleEntity on Monday July 04, 2022 @10:48AM (#31977628)
If I understand this property it takes a specification and generates a formally proven parser that lets you cast the bytes to a struct or runs code to do something with the data.

All automagic, can’t see how it could get much simpler than that.

Re:Hardening attack surfaces with formally proven binary for... by HillBates on Monday July 04, 2022 @06:28AM (#31975527)
formal verification is about functionality, not about your emotions.
Re:Hardening attack surfaces with formally proven binary for... by zen_1 on Monday July 04, 2022 @09:37PM (#31983406)
Haven't you heard? The only bugs are those caused by memory safety, and only switching to Rust can save us from the insanity of managing our own memory.
Re:Hardening attack surfaces with formally proven binary for... by jnash on Tuesday July 05, 2022 @12:41AM (#31984386)
You are joking right? Just checking :)
Re:Hardening attack surfaces with formally proven binary for... by zen_1 on Tuesday July 05, 2022 @09:05AM (#31987735)
Yes, I was being quite sarcastic above
Re:Hardening attack surfaces with formally proven binary for... by IshKebab on Monday July 04, 2022 @02:00PM (#31980023)
Windows' kernel is way ahead of Linux in many ways. It's a bit of a delusion that so many people think it hasn't advanced since Windows XP. Perhaps wilful denial.
Re:Hardening attack surfaces with formally proven binary for... by anitil on Monday July 04, 2022 @01:22AM (#31973736)
It's going to take me a while to fully understand this paper. I wonder what the route to incorporating something like this in the Linux kernel would look like?
Re:Hardening attack surfaces with formally proven binary for... by moby_click on Monday July 04, 2022 @02:35AM (#31974113)
Generating readable C code was an important goal from early on. Parts of the linux kernel would have to be translated to Low*, which is the subset of F*, that can be extracted to C.

I guess there would be a new build step, that runs when code is checked in, to not burden everyone with all the new toolchain (F*, z3, karamel, maybe OCaml and more). While the generated C code can be read and understood by C programmers, changes to that part should be done in Low* and that may require changes to proofs in F* or to the extraction tool (karamel). That's a pretty big investment for a project like linux and I guess, any work in that direction will happen on forks for a while, before there is enough confidence that such changes are sustainable.

A good first candidate may be HACL* (https://hacl-star.github.io), a cryptographic library that is already used in several projects.

Re:Hardening attack surfaces with formally proven binary for... by mbrodersen on Monday July 04, 2022 @05:43AM (#31975259)
The end result is generated C code. So you could simply add the generated C code to the kernel like you would any other C code. And keep the proof chain separate from the kernel. My guess is that it is what Microsoft is doing with the kernel code.
Re:Hardening attack surfaces with formally proven binary for... by anitil on Monday July 04, 2022 @07:35PM (#31982801)
My question was more around that it would have to replace existing code, so you'd need to advocate for it and come up with some way of incorporating it in the build. I'm not all that familiar with the development culture of the kernel but I imagine that large changes like this would have to be introduced slowly