CacheSquash: Making caches speculation-aware
Hossam ElAtali, N. Asokan
TL;DR
CacheSquash addresses Spectre-style cache-timing leaks by making the cache hierarchy speculation-aware through immediate cancellations of mis-speculated read requests. Implemented in gem5 with classic caches and evaluated on SPEC CPU 2017 and PARSEC, it achieves near-zero overhead while significantly reducing leakage in case studies including Spectre PHT and ret2spec. The approach relies on minimal hardware changes to the load-store unit and miss-handling circuitry, and is ISA-agnostic and software-compatible. While it shows strong protection in typical scenarios, the authors discuss limitations such as certain windowing gadgets and speculative-interference attacks, outlining directions like cancellation broadcasts and memory-bus cancellation for broader security.
Abstract
Speculation is key to achieving high CPU performance, yet it enables risks like Spectre attacks which remain a significant challenge to mitigate without incurring substantial performance overheads. These attacks typically unfold in three stages: access, transmit, and receive. Typically, they exploit a cache timing side channel during the transmit and receive phases: speculatively accessing sensitive data (access), altering cache state (transmit), and then utilizing a cache timing attack (e.g., Flush+Reload) to extract the secret (receive). Our key observation is that Spectre attacks only require the transmit instruction to execute and dispatch a request to the cache hierarchy. It need not complete before a misprediction is detected (and mis-speculated instructions squashed) because responses from memory that arrive at the cache after squashing still alter cache state. We propose a novel mitigation, CacheSquash, that cancels mis-speculated memory accesses. Immediately upon squashing, a cancellation is sent to the cache hierarchy, propagating downstream and preventing any changes to caches that have not yet received a response. This minimizes cache state changes, thereby reducing the likelihood of Spectre attacks succeeding. We implement CacheSquash on gem5 and show that it thwarts practical Spectre attacks, with near-zero performance overheads.
