SpectreShield: Design and Analysis of Spectre Countermeasures on RISC-V Using gem5
Speculative execution attacks like Spectre exploit microarchitectural side effects to leak sensitive data during transient execution. While various software and hardware countermeasures have been proposed for x86 and ARM architectures, their effectiveness and microarchitectural impact remain underexplored on RISC-V platforms. To study such attacks and evaluate these countermeasures, simulation tools like the gem5 simulator provide detailed insights into microarchitectural state changes during speculation. In this paper, we present the first comprehensive evaluation of Spectre-v1 countermeasures on the RISC-V architecture using the gem5 full-system simulator. We implement and assess four Spectre-v1 mitigations: index masking (CM1), randomized offset (CM2), fence-based serialization (CM3), and bitwise selection (CM4). Our experiments reveal that, in the absence of mitigations, Spectre-v1 enables $100 \%$ secret key recovery. In contrast, all proposed countermeasures reduce the recovery rate to below $1 \%$, with branch mispredictions decreasing by $\mathbf{4 1. 7 \% - 4 6. 3 \%}$. The paper analyzes the securityperformance trade-offs of each approach. Beyond demonstrating their effectiveness, we quantify their microarchitectural impact, measuring reductions in squashed instructions, DRAM latency variability, and return address stack mispredictions. This paper provides a practical framework for evaluating transient execution defenses and advances secure-by-design RISC-V processors.
Authors
- Muhammad Isa Khan (ORCID: https://orcid.org/0000-0002-3324-0532)
- Maria Mushtaq (ORCID: https://orcid.org/0000-0003-0046-2582)
- Ludovic Apvrille (ORCID: https://orcid.org/0000-0002-1167-4639)
- Renaud Pacalet
Institutions
- Télécom Paris (FR)
Publication Details
- Published
- 2025-08-04
- DOI
- https://doi.org/10.1109/csr64739.2025.11130017
- Primary Topic
- CCD and CMOS Imaging Sensors
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- BP