Collateral evolutions are a pervasive problem in Linux device driver development, due to the frequent evolution of Linux driver support libraries and APIs. Such evolutions are needed when an evolution in a driver support library affects the library’ interface, entailing modifications in all dependent device-specific code. Currently, collateral evolutions in Linux are done “nearly” manually. The large number of Linux drivers, however, implies that this approach is time-consuming and unreliable, leading to subtle errors when modifications are not done consistently.
In this talk, we describe the development of a language-based infrastructure, Coccinelle, with the goal of documenting and automating the kinds of collateral evolutions that occur in device driver code. We report our initial usage of Coccinelle on a range of the collateral evolutions identified in an earlier study. In many cases, Coccinelle can update 80% to 100% of the relevant Linux drivers fully automatically, with the remaining drivers requiring some manual adjustments due to variations in coding style that are not yet taken into account by our tool. We have additionally identified a number of drivers where the maintainer made some mistake in performing the collateral evolution, but Coccinelle transforms the code correctly. Our approach both eases and improves the robustness of the evolution process, and can address a variety of the problems that driver maintainers face in understanding and applying collateral evolutions in practice.