I decided to spend a day or two last month seeing if I could formally
prove some code inside qemu, and I arbitrarily picked one of the
smallest pieces of code in the "util/" subdirectory:
I decided to spend a day or two last month seeing if I could formally
prove some code inside qemu, and I arbitrarily picked one of the
smallest pieces of code in the "util/" subdirectory:
Frama-C parsed the C code and the formal specification and machine
checked it, and it's correct - the code is bug-free.
Frama-C parsed the C code and the formal specification and machine
checked it, and it's correct - the code is bug-free.
Obviously this is a single line, very trivial function, but I was
quite pleased that I was able to prove it quickly. I kept going on
the range file. The next function is:
Obviously this is a single line, very trivial function, but I was
quite pleased that I was able to prove it quickly. I kept going on
the range file. The next function is:
The next function is range_make_empty, again easy to prove using the
already existing empty_range predicate. Notice how we declare which
memory locations this function assigns to:
The next function is range_make_empty, again easy to prove using the
already existing empty_range predicate. Notice how we declare which
memory locations this function assigns to:
On to the next function. Again this seems very simple, but in fact it
contains a serious problem:
On to the next function. Again this seems very simple, but in fact it
contains a serious problem:
- It probably doesn't make sense for qemu right now though, unless we
could prove more substantial pieces of code.
- It probably doesn't make sense for qemu right now though, unless we
could prove more substantial pieces of code.
Now you might be asking what happens when you write a function that
uses strlen, for example this trivial function with a working
specification:
Now you might be asking what happens when you write a function that
uses strlen, for example this trivial function with a working
specification: