Skip to main content
QUICK REVIEW

[Paper Review] Verifying RISC-V Physical Memory Protection

Kevin Cheang, Cameron Rasmussen|arXiv (Cornell University)|Nov 3, 2022
Security and Verification in ComputingComputer Science6 citations
TL;DR

This paper formally verifies the RISC-V Physical Memory Protection (PMP) hardware module in the Rocket Chip core using the LIME toolchain and Uclid5 verification framework. It establishes functional correctness of the PMPChecker module under default configurations, providing a foundational step toward verifying the security guarantees of the Keystone trusted execution environment by ensuring PMP enforces memory access permissions as specified in the RISC-V ISA.

ABSTRACT

We formally verify an open-source hardware implementation of physical memory protection (PMP) in RISC-V, which is a standard feature used for memory isolation in security critical systems such as the Keystone trusted execution environment. PMP provides per-hardware-thread machine-mode control registers that specify the access privileges for physical memory regions. We first formalize the functional property of the PMP rules based on the RISC-V ISA manual. Then, we use the LIME tool to translate an open-source implementation of the PMP hardware module written in Chisel to the UCLID5 formal verification language. We encode the formal specification in UCLID5 and verify the functional correctness of the hardware. This is an initial effort towards verifying the Keystone framework, where the trusted computing base (TCB) relies on PMP to provide security guarantees such as integrity and confidentiality.

Motivation & Objective

  • To formally verify the functional correctness of the PMP hardware module in the RISC-V Rocket Chip core, which is critical for memory isolation in security-critical systems.
  • To close the gap in formal verification of low-level PMP hardware by specifying and verifying PMP rules based on the RISC-V ISA manual.
  • To establish a foundation for verifying the trusted computing base (TCB) of the Keystone trusted execution environment, where PMP is central to enforcing integrity and confidentiality.
  • To demonstrate the feasibility of using automated toolchains (LIME, Uclid5) to translate Chisel/FIRRTL hardware descriptions into formally verifiable models.

Proposed method

  • Formal specification of PMP behavior based on the RISC-V ISA manual, defining access rules for read, write, and execute permissions based on address matching and priority ordering.
  • Automatic translation of the Rocket Chip PMPChecker module from Chisel to FIRRTL, then to Uclid5 using the LIME toolchain for formal verification.
  • Encoding of PMP access control logic in Uclid5, including handling of three exception cases: no matching region, high-privilege mode, and prioritized matching.
  • Verification using 1-step induction with the Z3 solver, validating that the PMPChecker correctly enforces permissions across all valid address and configuration inputs.
  • Restriction to default configuration to reduce verification complexity while maintaining functional correctness for practical use.
  • Model extraction and modular verification focused solely on the PMPChecker module, isolating it from other system components like TLB and PTW.

Experimental results

Research questions

  • RQ1Does the PMPChecker module in Rocket Chip correctly enforce RISC-V PMP access rules as specified in the ISA manual?
  • RQ2Can automated toolchains like LIME and Uclid5 effectively translate and verify RTL-level hardware designs for security-critical properties?
  • RQ3Is the functional correctness of PMP sufficient to guarantee memory isolation in systems like Keystone, or are additional components required?
  • RQ4What is the performance and scalability of formal verification for a real-world RISC-V hardware module using this pipeline?

Key findings

  • The PMPChecker module in Rocket Chip is functionally correct under the default configuration, as verified by Uclid5 using 1-step induction.
  • The verification process completed in 41.331 seconds on a standard 2.6 GHz Intel Core i7 machine with 16 GB RAM, demonstrating practical feasibility.
  • The Chisel implementation of 48 lines of code translated into a 1,125-line Uclid5 model, showing the scalability of the LIME-Uclid5 pipeline.
  • The formal specification correctly models all three exception cases: no matching region, high-privilege mode, and prioritized matching of PMP entries.
  • The results confirm that the PMPChecker correctly computes read, write, and execute permissions based on the lowest-numbered matching PMP entry and its configuration.
  • The work establishes a critical first step toward verifying the full TCB of the Keystone trusted execution environment, though future work is needed to include TLB, PTW, and software components.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.