RISC-V O-CFI Control Flow Validation Against Code Reuse Attacks

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The O-CFI mechanism is difficult to implement in general computer systems due to its reliance on Intel x86/x64-specific memory-protection extensions, limiting its applicability to other system architectures, and existing defense methods against code reuse attacks are inadequate.

Innovation Solution

A RISC-V and O-CFI mechanism-based defense method that constructs a control flow graph, randomizes basic block order, and uses RISC-V extended instructions to verify and restrict illegal control flow transfers, enhancing security by identifying and managing control flow through hardware-assisted analysis.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If O-CFI mechanism is implemented using Intel x86/x64 memory-protection extensions, then control flow security is improved, but adaptability to other system architectures deteriorates

Engineering Contradiction:
Improvecontrol flow securityVSAvoidadaptability to other system architectures
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent implements O-CFI mechanism on RISC-V architecture by designing architecture-independent control flow graph construction and validation methods. The solution uses generic data structures (CFG, dominator tree, reverse post-order numbering) that can be applied across different CPU architectures, making the security mechanism universally applicable rather than x86-specific.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent divides the control flow validation into discrete, architecture-agnostic components: control flow graph construction, dominator tree generation, and runtime validation checks. Each component operates independently using standardized representations that can be mapped to different hardware architectures, enabling portability while maintaining security effectiveness.

Inventive Principle:
Principle #1Segmentation

2Reliability

If control flow transfer verification is performed at runtime, then code reuse attack defense is improved, but system execution overhead increases

Engineering Contradiction:
Improvecode reuse attack defenseVSAvoidsystem execution overhead
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent performs control flow graph construction, dominator tree generation, and boundary calculation during the compilation phase rather than at runtime. This preliminary preparation stores validation information in data structures that enable fast runtime checks, shifting the computational burden to compile time when the program is not subject to execution overhead constraints.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates compact representations of control flow information (CFG, dominator relationships, boundary ranges) that can be efficiently stored and queried at runtime. By copying and storing pre-computed validation data in optimized data structures, the runtime verification achieves high speed with minimal overhead while maintaining comprehensive security checks.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS12417287B2RISC-V and O-CFI mechanism-based defense method and apparatus for code reuse attacks
Publication Date: 2025.09.16 INST OF SOFTWARE - CHINESE ACAD OF SCI
  • US12417287B2 patent drawing
  • US12417287B2 patent drawing
  • US12417287B2 patent drawing

AI summary

Disclosed are a RISC-V and O-CFI mechanism-based defense method and apparatus for code reuse attacks, comprising: constructing a control flow graph according to program source codes randomized in a basic block order; on the basis of the control flow graph, obtaining a boundary range of a control flow transfer branch; executing the program source codes, obtaining a target node to which each control flow is to be transferred, and analyzing each target node in combination with the boundary range so as to defend against an abnormal control flow. The present invention can identify an illegal control flow transfer with the assistance of RISC-V security hardware according to the characteristics of a program control flow itself, and effectively handle code reuse attacks, thereby enhancing the security defense capabilities of an RISC-V system.