Libvharness is a cross-architecture and cross-platform library to create LibAFL QEMU compatible harnesses. It can be built for a large variety of target architectures, for different OSes, while sharing the same API. Two APIs are supported: LibAFL QEMU (lqemu) and Nyx.
The usual stuff for cmake project:
mkdir build
cd build
cmake ..
make -j
cmake --install . --prefix <install_path>There are a few Cmake variables to modify to adapt the build to your needs.
CMAKE_TOOLCHAIN_FILE: points to one of the files intoolchains, to choose depending on the target arch.VHARNESS_API: eitherlqemuornyx, to choose the target API.
You may also have to configure the right compiler toolchain, using the usual cmake variables for that.
Once the build is done, <install_path> will contain 2 directories: include and lib.
lib: contains the static library to link with. Should be linked with your harness.include: the include files to use. there are 2 files that should be interesting to include:lqemu.hif using the LibAFL QEMU API.nyx.hif using the Nyx API.
To ensure maximum compatibility of the library across architectures, a very minimal libc implementation is available: femtolibc.
It is only used for generic toolchains by default, when a full-fledged libc is not considered to be available.
The implementation is not tailored for performance, so it is always better to use another libc when it is available in the toolchain. However, it is not expected to observe major performance overhead in most cases.