Software Verification for TinyOSLinks and DocumentationUnder the EPSRC UbiVal project, we developed prototype tools for software verification (i.e. model checking directly from source code) for TinyOS sensor applications, on two subtopics:
Summary
In order to apply software verification to such sensor code, we built a prototype tool chain capable of passing TinyOS code into CBMC, a bounded model checker for ANSI-C (and C++) programs, from the CProver group. Our tool, tos2cprover, "links" the nesc compiler and CBMC (as in the figure). It takes in input the MSP430-specific inlined C program generated by the nesc compiler. tos2cprover then models the assembly lines into high-level C, and replaces direct accesses to memory by accesses into a high-level C model of the microcontroller. Then, it instruments the resulting program with calls to interrupt handlers, to mimic the existence of hardware interrupts.
*(uint8_t*)49U &= ~(0x01 << 6);gets translated into _P5OUT &= ~(0x01 << 6);
Calls to interrupt handlers: /* IRQ INSTRUMENTATION */
if (int_enabled()) {
disable_int();
sig_ADC_VECTOR();
enable_int();
}
are inserted in the resulting program, the number of these instrumentations minimized with a partial-order reduction.
CBMC can then verify the code with any programmer-introduced assertions; CBMC itself introduces assertions guarding against standard
bugs such as memory violations (null-pointer dereferences still need manual inspection in out case) and arithmetic exceptions.
| |
|
| |