1. Prototype tool
The analysis of the Linux kernel are implemented with SmPL rules, using the Coccinelle program matching and transformation engine.
2. Details on safety hole categories
The safety holes that we focus on belong to various categories dealing with pointer dereference, critical sections, irq management, memory allocation, data exchange between user and kernel spaces.
Each of these categories is divided into into an Entry and an Exit safety hole, to better differentiate two instances of safety holes :
-
entry : the safety hole is triggered in the code of the exported function when the calling code does not respect some given precondition.
-
exit : the exported function finishes its execution but has activated a safety hole that can be triggered after returning to the calling code.
-
entry : An exported function dereferences one of its parameter with no prior checks.
-
exit : An exported function returns NULL.
We have augmented this category by writing analysis rules for a more complex case where the invalidity of dereferenced pointer is indirectly related to the invalidity of a parameter of the exported function. For the exit safety hole, we also extend the analysis to another widespread error return value : ERR_PTR. |
|
-
entry : An exported function disables interrupts or acquires a lock that is derived from a parameter
-
exit : An exported function returns while holding a lock it has acquired or after disabling interrupts.
We have augmented the entry safety hole by also searching for exported functions that suppose the lock is held and therefore attempt to release it. This analysis rule is based on report of real bug in in-kernel code. |
|
-
entry : An exported function calls a blocking function.
-
exit : An exported function disables interrupts and returns without reenabling them
|
-
entry : An exported functon dereferences a value derived from a parameter.
-
exit : An exported function frees memory derived from a parameter
|