100% Verifiable Bug-Free Code Is Possible
It doesn't matter how bug-free your application software is if the underlying OS is bug-ridden. But considering the size and complexity of modern operating systems (Windows XP is said to consist of more than 40-million lines of code), bug-free is easier said than done.
The usual solution then, is simply to reduce the amount of privleged code (that is, the part of the system executing in the most privleged mode of the processor), following the principle of "less code means fewer bugs". On the other hand, this approach does impose limitations of sorts.
While that may seem satisfactory in some regards, it isn't satisfactory to researchers at Open Kernel Labs (OK Labs) and Australia's National Information and Communications Technology Research Centre (NICTA) who clearly fall into the category of people who "want their cake and eat it too." In other words, they wanted a verifiable correct, reliabile, and secure microkernel that was also powerful.
Consequently, they set out to create a mathematical method for proving the correctness of the underlying source code of OKL4, OK Labs' virtualization platform for mobile devices using formal logic and programmatic theorem checking. And what they ended up with was seL4, to the best of their knowledge "the world's first 100% verified 'bug free' embedded software." The verification process they implemented eliminated a wide range of exploitable errors, such as design flaws and common code-based errors, buffer overflows, null-point dereferences, memory leaks, arithmetic overflows, and exceptions.
The seL4 kernel (short for "secure embedded L4") is a third-generation microkernel, comprising 8,700 lines of C code and 600 lines of assembler, that runs on ARMv6 and x86 platforms. According to OK Labs, this is the first formal proof of functional correctness of a complete, general-purpose operating-system kernel. In this case, "functional correctness" means that the implementation always strictly follows a high-level abstract specification of kernel behavior. This includes traditional design and implementation safety properties (such as the kernel will never crash, and it will never perform an unsafe operation). It also proves that programmers can predict precisely how the kernel will behave in every possible situation.
According to OK Labs:
- seL4 is suitable for real-life use, and able to achieve performance that is comparable with the best-performing microkernels.
- seL4's behavior is precisely formally specified at an abstract level.
- seL4's formal design is used to prove desirable properties, including termination and execution safety;
- seL4's implementation is formally proven to satisfy the specification.
- seL4's access control mechanism is formally proven to provide strong security guarantees.
All in all, the paper describing what NICTA and OK Labs have done is fascinating, not to mention the project itself.

