Cancellable Memory Requests: A transparent, lightweight Spectre mitigation

Hossam ElAtali,N. Asokan
2024-06-18
Abstract:Speculation is fundamental to achieving high CPU performance, yet it enables vulnerabilities such as Spectre attacks, which remain a significant challenge to mitigate without incurring substantial performance overheads. These attacks typically unfold in three steps: they speculatively access sensitive data (access), alter the cache state (transmit), and then utilize a cache timing attack (e.g., Flush+Reload) to extract the secret (receive). Most Spectre attacks exploit a cache timing side channel during the transmit and receive steps. Our key observation is that Spectre attacks do not require the transmit instruction to complete before mis-prediction is detected and mis-speculated instructions are squashed. Instead, it suffices for the instruction to execute and dispatch a request to the memory hierarchy. Responses from memory that arrive after squashing occurs still alter the cache state, including those related to mis-speculated memory accesses. We therefore propose a novel mitigation technique, Cancellable Memory Requests (CMR), that cancels mis-speculated memory requests. 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 reduces the likelihood of cache state changes, thereby reducing the likelihood of Spectre attacks succeeding. We implement CMR on gem5 and show that it thwarts practical Spectre attacks, and has near-zero performance overheads. We show that CMR can completely thwart Spectre attacks in four real-world processors with realistic system configurations.
Cryptography and Security,Hardware Architecture
What problem does this paper attempt to address?
The problem that this paper attempts to solve is: how to effectively mitigate Spectre attacks without affecting performance. Specifically, Spectre attacks take advantage of the speculative execution mechanism in modern processors to leak sensitive information, such as encryption keys. Such attacks are usually divided into three steps: accessing sensitive data, transmitting data through side - channels (such as modifying the cache state), and extracting secret information through cache - timing attacks (such as Flush+Reload). ### Problem Description 1. **Speculative Execution and Spectre Attacks**: Modern processors use speculative execution to optimize performance, that is, predicting and executing instructions in advance. However, this mechanism also brings security vulnerabilities, especially Spectre attacks. Spectre attacks use speculative execution to access architecturally inaccessible secret data and leak this data through cache - timing side - channels. 2. **Insufficiencies of Existing Mitigation Measures**: Current mitigation measures either have too much performance overhead or cannot completely prevent the attacks. Therefore, a new method is needed to effectively prevent Spectre attacks while maintaining high performance. ### Solution Proposed in the Paper The paper proposes a new technology named "Cancellable Memory Requests (CMR)". The core idea of CMR is to immediately cancel requests sent to the memory hierarchy when speculative instructions are revoked, thereby preventing these requests from changing the cache state. Specifically: - **Cancellation Mechanism**: When speculative instructions are revoked, the system will immediately send a cancellation signal to the cache hierarchy, blocking any unfinished memory requests. - **Reducing Cache - State Changes**: By canceling unfinished memory requests, CMR reduces cache - state changes, thereby reducing the likelihood of a successful Spectre attack. ### Main Contributions 1. **Proposing the CMR Mechanism**: A mechanism independent of the instruction - set architecture that can cancel memory requests when speculative instructions are revoked without changing the software or external hardware interface. 2. **Implementation and Evaluation**: CMR was implemented in the gem5 simulator, and its effectiveness against multiple Spectre attacks was demonstrated, with almost zero performance overhead. 3. **Security Analysis**: By configuring system parameters, it was proven that CMR can completely prevent Spectre attacks in four actual processors. 4. **Case Studies**: The effectiveness of CMR was verified through multiple examples of Spectre attacks. ### Summary By introducing the CMR mechanism, the paper provides a method to effectively mitigate Spectre attacks while maintaining high performance. This method is not only applicable to existing instruction - set architectures but also does not require modification of software or external hardware, and has wide applicability and practicality.