Prevention of Microarchitectural Covert Channels on an Open-Source 64-bit RISC-V Core

Nils Wistoff, Moritz Schneider, Frank K. Gürkaynak, Luca Benini, Gernot HeiserarXiv 2020

Abstract

Covert channels enable information leakage across security boundaries of the operating system. Microarchitectural covert channels exploit changes in execution timing resulting from competing access to limited hardware resources. We use the recent experimental support for time protection, aimed at preventing covert channels, in the seL4 microkernel and evaluate the efficacy of the mechanisms against five known channels on Ariane, an open-source 64-bit application-class RISC-V core. We confirm that without hardware support, these defences are expensive and incomplete. We show that the addition of a single-instruction extension to the RISC-V ISA, that flushes microarchitectural state, can enable the OS to close all five evaluated covert channels with low increase in context switch costs and negligible hardware overhead. We conclude that such a mechanism is essential for security.

Introduction

Modern processors are optimized for performance, often at the expense of security. To achieve high execution speeds, they utilize "microarchitectural state"—components like caches, branch predictors, and Translation Lookaside Buffers (TLBs) that retain history from previous executions. While an operating system (OS) can enforce spatial isolation (preventing one program from reading another's memory), it traditionally struggles to prevent timing-based leakage. This paper, originally presented at the CARRV '20 workshop, introduces a hardware-software co-design approach to silence these "ghosts" in modern computer security.

The Mechanics of Microarchitectural Leakage

Microarchitectural covert channels arise when a "Trojan" program and a "Spy" program share hardware resources. If a Trojan accesses specific cache lines, a Spy running later on the same core will observe faster access times for those same lines. This timing discrepancy creates a communication channel that bypasses OS security boundaries.

Abstract model of a covert channel where a Trojan's secret is leaked to a Spy via execution time variations.

Previous research has shown that software-only attempts to "flush" this state are either prohibitively slow or incomplete. They often leave behind "secondary state"—internal bits of a cache replacement policy or branch history—that can still be exploited to leak secrets.

Hardware-Software Co-Design: The fence.t Instruction

To address these vulnerabilities, the researchers propose a new RISC-V instruction: fence.t (temporal fence). Unlike standard memory fences, fence.t is designed to physically reset the microarchitectural state of all stateful components during a context switch.

The bit-level encoding of the new fence.t instruction within the RISC-V ISA.

Implemented on the Ariane open-source 64-bit RISC-V core, this instruction sends a hardware signal to reset L1 caches, TLBs, and branch predictors. This ensures that no execution history persists across the security boundary established by the microkernel.

Methodology and Evaluation

The efficacy of the fence.t instruction was evaluated using the Prime-and-Probe (P&P) attack across five target channels: L1 Data Cache, L1 Instruction Cache, TLB, Branch Target Buffer (BTB), and Branch History Table (BHT). Leakage was quantified using Mutual Information ($M$), compared against a Zero Leakage Upper Bound ($M_0$) to ensure statistical significance.

The evaluation utilized the channel bench framework and the Mastik side-channel toolkit, ported to the RISC-V architecture and running on an FPGA implementation of the Ariane core.

Key Insights and Results

  • The Danger of Secondary State: A critical finding was that clearing only "valid bits" is insufficient. Internal state, such as Pseudo-LRU replacement counters or LFSRs used for victim selection, can still leak information. The fence.t instruction was specifically designed to clear both first- and second-order state.
  • Eliminating Leakage: With the implementation of the temporal fence, mutual information dropped below the noise floor ($M < M_0$) for all five evaluated channels, effectively closing them.
  • Performance and Cost: The fence.t instruction is highly efficient, adding only ~320 cycles to a context switch. This is a massive improvement over software-only "priming" methods, which took over 51,000 cycles and remained insecure. Furthermore, the hardware modification required less than a 1% increase in FPGA resource utilization.

Conclusion

This research demonstrates that security cannot be a software-only responsibility. The Instruction Set Architecture (ISA) must provide the operating system with the necessary hardware "knobs" to enforce time protection. By adding a simple, low-overhead instruction like fence.t, hardware designers can empower secure microkernels like seL4 to completely eliminate microarchitectural timing leaks, providing a robust foundation for secure computing.

Summary updated

BibTeX
@misc{wistoff2020prevention,
  author = {Nils Wistoff and Moritz Schneider and Frank K. Gürkaynak and Luca Benini and Gernot Heiser},
  title = {{Prevention of Microarchitectural Covert Channels on an Open-Source 64-bit RISC-V Core}},
  year = {2020},
  eprint = {2005.02193},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.02193},
}
Figure