Run-time Binary Patching for Systems with Dynamically Loadable Modules
Multiverse is an approach to handle dynamic variability efficiently by means of binary patching. It provides an extension to the C programming language that enables the developer to express dynamic variability in performance-critical paths. With specially annotated config variables, multiverse can generate multiple versions of a function and dynamically binary patch the running system to use the version of the current configuration. The goal is to narrow the gap between dynamic and static variability by allowing the developer to easily employ run-time configurability at zero or low cost.
Some software systems come with module systems that offer a kind of coarse granular variability. Module systems allow loading machine code during run time. They enable the user to add additional functionality without having to modify the original program. This is useful for several of reasons: smaller binary sizes, less trusted code and easy integration of third-party extensions. Examples of such systems include operating system kernels, like Linux or BSD, but also server software, like Apache or nginx, and even end-user programs, such as GIMP (graphics editor), Audacity (audio editor), or mpv (media player).
The traditional dynamic linking of dynamic libraries is quite similar to module systems. In both mechanisms, additional code is loaded into the program. In contrast to extension module systems, dynamic libraries get loaded before the run time and are typically essential to the program.
Multiverse as a run-time code modification mechanism currently depends on a monolithic target binary. The goal of this thesis is to explore the possibility to use a binary editing mechanism like Multiverse in conjunction with module systems and dynamic linking. As part of the work, the necessary extensions to the semantic and the implementation of multiverse should be introduced. To evaluate the approach in a real-world scenario, it should be applied in the Linux kernel.
Multiverse: Compiler-Assisted Management of Dynamic Variability in Low-Level System Software
Fourteenth EuroSys Conference 2019 (EuroSys '19)ACM Press2019.