Call Rewinding: Efficient Backward Edge Protection

Authors

  • Téo Biton Thales Research & Technology, F-91767 Palaiseau, France; Nantes Université, CNRS, IETR UMR 6164, F-44000 Nantes, France
  • Olivier Gilles Thales Research & Technology, F-91767 Palaiseau, France
  • Daniel Gracia Pérez Thales Research & Technology, F-91767 Palaiseau, France
  • Nikolai Kosmatov Thales Research & Technology, F-91767 Palaiseau, France
  • Sébastien Pillement Nantes Université, CNRS, IETR UMR 6164, F-44000 Nantes, France

DOI:

https://doi.org/10.46586/tches.v2025.i1.227-250

Keywords:

control-flow integrity, return-oriented programming, RISC-V, shadow stack, branch prediction

Abstract

The prevalence of memory-unsafe software prompts significant efforts by the research community to mitigate memory corruption bugs. This endeavor is crucial for safeguarding critical systems against security threats. Specifically, there is a focus to protect against code-reuse attacks through enforcing control-flow integrity (CFI). This paper introduces call rewinding, a novel microarchitecture-level mechanism for protection of return addresses. It is based on a property of the calling convention that is common to major architectures such as x86, ARM and RISC-V, which states that all return instructions transfer control to a valid call site. Call rewinding consists of jumping to the instruction preceding the return target for each return instruction and checking if the instruction at this address is a call or not. On systems equipped with return address prediction, a commonly employed optimization, the security check is performed only on mispredicted return addresses. The proposed protection mechanism demonstrates negligible impact on both area and performance. We implement call rewinding on the CV64A6, a RISC-V CPU with consequent branch prediction support. Our evaluation validates the effectiveness of call rewinding, both in bare-metal and in a Linux operating system (OS) environment. It triggers no false positives in bare-metal and is functional with the OS extended with a custom exception handler. Furthermore, our findings indicate that call rewinding successfully detects unauthorized return addresses, highlighting its potential as a reliable and efficient security mechanism.

Downloads

Published

2024-12-09

Issue

Section

Articles

How to Cite

Call Rewinding: Efficient Backward Edge Protection. (2024). IACR Transactions on Cryptographic Hardware and Embedded Systems, 2025(1), 227-250. https://doi.org/10.46586/tches.v2025.i1.227-250