Hyperkernel – A push-button approach to building provably correct OS kernels
unsat.cs.washington.edu
unsat.cs.washington.edu
This little verified OS should be useful for routers, IoT devices, and such.
> The beauty of symbolic execution lies in its ease of use: it enables automatic code analysis, hence can be used by developers without verification expertise. The challenge with symbolic execution is its notorious lack of scalability: applying it to real C code typically leads to path explosion. The part of real NF code that typically leads to unmanageable path explosion is the one that manipulates state. Hence, we split NF code into two parts:
> A library of data structures that keep all the “difficult” state, which we then formally prove to be correct—this takes time and formal methods expertise, but can be amortized if the library is re-used across multiple NFs.
> Stateless code that uses the library, which we automatically and quickly verify using symbolic execution.
> The challenge lies in combining the results of these two verification techniques, and for that we developed a technique we call “lazy proofs”
I have lots of thoughts about proving hardware/software/firmware correctness. Let's just say it's very hard.
There is no solution to such things as "bitflip in memory" because once that happens, all bets are off. Instructions could be entirely wrong, page tables could have been corrupted, pointers in kernel memory pointing anywhere but where they belong, fire and brimstone raining from the sky, the dead walking among the living and the local supermarket running out of chocolate.
You can however reduce the risk that such a bitflip results in a full system-, security- or application failure via various means (the Apollo 11 computer for example was capable of simply restarting a program at various checkpoints if they crashed and had multiple software and hardware safeguards against bitflips and random crashes).
https://en.wikipedia.org/wiki/ECC_memory https://en.wikipedia.org/wiki/Redundancy_(engineering)
The best we can do is deploy ECC, hope the cosmic rays don't hit our Datacenter too hard and design software to fail fast if it fails, even if math says it can't fail. Because it will fail.
There is also a number of other hardware failure scenarios.
Static typing for a faulty lambda calculus: http://lambda-the-ultimate.org/node/2108
You can build as much fault tolerance as you like to the point where you'd have to wait for a proton to decay before you see an error.
Famously, a Microsoft intern modeled the XBox's cache coherence protocol and caught a bug there before they went to prod.
Certainly bit flips can happen, but you can still prove that circuits obey your invariants!
(Note: TLA+ doesn't always fully prove correctness. Z3 is a more sophisticated approach but harder to apply to temporal logic)
xdcbt bug?
http://channel9.msdn.com/Events/Build/2014/3-642#time=21m46s
> A little closer to home, Lamport shared an anecdote of how his programming language even helped Microsoft avert a near-certain disaster. While writing a TLA+ specification for an IBM-developed memory system chip in the Xbox 360, a Microsoft intern discovered a bug that would cripple the game console. The IBM engineers’ first reactions were of disbelief, saying it could not possibly happen, Lamport said. However, they changed their tune a few weeks later. “Their tests would not have discovered it, and had this intern not discovered this bug, it would have gone into production; every Xbox would have crashed after four hours of use. [That’s] a nice success story.”
Source: https://www.asianscientist.com/2016/01/features/gyss-2016-le...
The flip side is, your CPU may need a firmware update. >_>
https://en.wikipedia.org/wiki/ACL2
NQTHM was used to check e.g. FM9001 CPU
ftp://ftp.cs.utexas.edu/pub/boyer/nqthm/nqthm-bibliography.html
B. Brock, W. A. Hunt, and M. Kaufmann. The FM9001 Microprocessor Proof. Tech. Rept. 86, Computational Logic, Inc., 1994. ftp://ftp.cs.utexas.edu/pub/boyer/cli-reports/086.pdf
Given that this is a research project i'd hold off on making assumptions that the software has been adequately verified as well. Forgive the loose usage of Rumsfeld-like terminology here, verification implementation errors (Unknown Unknowns) and omissions (Unknown Unknowns) in the verification translate to exploitable software security holes. If the model is sound, it would address all Known Unknowns and to get a verified, working codebase the developers would have to address Known Knows. And there may be some security tech-debt as well which isn't mentioned publicly (Unknown Knowns).
That helps, but doesn't answer the question. This part is very helpful:
> Files we created are licensed under the Apache License, Version 2.0, viewable at http://www.apache.org/licenses/LICENSE-2.0, and are marked as such.
This part makes it useless:
> Code borrowed from other sources keeps the original copyright and license.
What are those licenses? If they used a package manager I could just see that (a nice easy list). As it is, I can't tell what rights and requirements I have.
does formally verified also mean bug-free?
This does not mean that the kernel is guaranteed to have zero bugs. There can be bugs in unverified code (e.g., initialization and glue code), the specification (or things not modeled in the specification), or the verification toolchain including irpy/ and Z3.
Code meeting spec doesn't magically make the spec right.
The spec is the human interface to the expected behavior of the program, while the code is the human interface to the actual behavior of the program.
If not, then it wouldn't surprise me that there's a conformance problem between the Isabelle, the Haskell, the C, and the asm.
We only use x86_64 for convenience during active hacking on our workstations, then we simulate ARM for local testing and intermediate CI, and do release candidate CI & deployments to ARM target hardware.