DynMELF: Extending the LLVM Linker to Support Dynamic Library Switching in MELFs

When building software, developers are able to instrument the compiler to generate specialized binaries for various types of configurations, such as different processor architectures (Instruction-Set Architectures), additional security features (e.g. stack protection), runtime performance optimization and many others. In addition, developers often include their own types of static application configuration which further prescribe the code of the final executable.

Multivariant Executables allow to gather all these compile-time generated application variants in one executable and switch between these variants dynamically, during runtime. Variants can be defined on a per-function granularity and include multiple functions, thus leading to a large scale adaption of the runtime behavior of the application. By placing all function variants at the same virtual address, the MELF linker ensures that the exchange of different variants is semantically correct and sound.

With the existing approach, MELFs allow to switch between different static, compile-time generated function implementations, but does not take dynamically-linked function implementations into consideration. This limits the applicability of the MELF approach, as dynamically linked functions themselves can make use of the aforementioned compiler instrumentations as well. For example, being able to switch between two implementations of a cryptographic function which stem from two different dynamically-linked libraries can be very useful when working with a heterogeneous ISA setup.

The core idea of this thesis is to explore the possiblity of exchanging dynamically linked function implementations to make the MELF approach more transitive by supporting dynamically linked libraries. To show applicability, an evaluation should be included that provides simple proof-of-concepts tests as well as a proof-of-concept in a real-world application, ideally extended by a performance benchmark to compare with existing approaches, that do allow for similar behavior (dlopen() for example).

USENIX Conference A
MELF: Multivariant Executables for a Heterogeneous World
Dominik Töllner, Christian Dietrich, Illia Ostapyshyn, Florian Rommel, Daniel Lohmann2023 USENIX Annual Technical Conference (USENIX '23)USENIX Association2023.
PDF Details [BibTex]