Description
System software, such as operating system kernels and hypervisors, forms the backbone of modern digital infrastructure, providing isolation between processes or virtual machines. Given their critical roles and significant attack surface, the correctness of their implementation is especially important. While Address Sanitizer and Memory Sanitizer can simplify the detection of memory safety violations in userspace, for kernelspace software we find that implementing these concepts requires significant customization, in part in memory management and bootstrapping. Likely as a result of such challenges, kernel sanitizer implementations remain limited to a few, established projects. We propose simplifying this implementation work by providing the shadow memory mapping through HV-based instrumentation of the target system, and combining with this approach existing compiler-instrumentation and largely reusable runtime code additions. We evaluate the described system as patches to KVM and QEMU, enabling system-specific porting of ASAN and MSAN to Xen and the OpenBSD kernel with reduced manual effort. We show that our approach has performance characteristics comparable to native kernel sanitizers in virtualized environments and finds seven new memory safety bugs between both targets through integration in two pre-existing fuzzing pipelines.
|