On Kernel's Safety in the Spectre Era (Extended Version)
Davide Davoli, Martin Avanzini, Tamara Rezk
TL;DR
This work formalizes kernel safety in the Spectre era by first proving that kernel-layout-randomization yields probabilistic kernel safety under a classic attacker model with memory separation. It then shows that speculative execution and side-channels break these guarantees unless a stronger property, speculative layout non-interference, is adopted; it also introduces a semantics-preserving program transformation to enforce speculative kernel safety for systems that are already kernel-safe in the classic model. The results establish a formal foundation linking kernel safety to spatial-memory safety and CFI while proposing practical instrumentation (fences) to mitigate speculative leaks. Overall, the paper advances kernel security beyond layout randomization by combining formal models, non-interference concepts, and enforceable transformations, paving the way for robust defenses in the Spectre era.
Abstract
The efficacy of address space layout randomization has been formally demonstrated in a shared-memory model by Abadi et al., contingent on specific assumptions about victim programs. However, modern operating systems, implementing layout randomization in the kernel, diverge from these assumptions and operate on a separate memory model with communication through system calls. In this work, we relax Abadi et al.'s language assumptions while demonstrating that layout randomization offers a comparable safety guarantee in a system with memory separation. However, in practice, speculative execution and side-channels are recognized threats to layout randomization. We show that kernel safety cannot be restored for attackers capable of using side-channels and speculative execution and introduce a new condition, that allows us to formally prove kernel safety in the Spectre era. Our research demonstrates that under this condition, the system remains safe without relying on layout randomization. We also demonstrate that our condition can be sensibly weakened, leading to enforcement mechanisms that can guarantee kernel safety for safe system calls in the Spectre era.
