1 of 22

The Design and Implementation of a

Virtual Firmware Monitor

SOSP 2025

Charly Castes1 François Costa2 Neelu S. Kalani1

Timothy Roscoe2 Nate Foster3 Thomas Bourgeat1 Edouard Bugnion1

2 of 22

Summary

Problem: Firmware has become a security liability

  • Millions of lines of legacy code
  • Unfettered access to the machine

We need to limit the blast radius in case of compromise!

Solution: Firmware-level virtualization

  • Backward compatibility
  • No performance overhead

2

Charly Castes | SOSP’25

3 of 22

Background: Firmware

3

4 of 22

Background: Firmware

Firmware comes in two flavors:

  • Smaller computing components
  • The application CPU firmware

4

Definition: Firmware is all the software that is required to set and maintain the hardware in an operable state.

Charly Castes | SOSP’25

5 of 22

Background: Firmware

5

U-Mode

M-Mode

S-Mode

Firmware

EL1

EL3

EL2

Hypervisor

Kernel

User App

EL0

In this talk, we focus on the application CPU firmware

Firmware

Kernel

User App

Charly Castes | SOSP’25

6 of 22

Background: Server-Grade Firmware

Cavium ThunderX firmware:

  • SoC drivers (PCIe, co-processors, …)
  • Full libc with:
    • File System
    • Network (IP/TCP)
    • Multi-threading
  • Lua interpreter
  • GUI

6

Towards a Unified Firmware for Enzian, Thomas Meyer-Lehnert (ETHZ)

https://doi.org/https://doi.org/10.3929/ethz-b-000717771

There is a full-blown OS below the OS!

1 million LoC

Charly Castes | SOSP’25

7 of 22

Background: Firmware is a Security Liability

7

Firmware is a time bomb, we need to be prepared

Charly Castes | SOSP’25

8 of 22

Solution: Virtual Firmware Monitors

(VFM)

8

9 of 22

  1. Classical Virtualization

Classical virtualization, also called software virtualisation, relies on trapping and emulating privileged instructions

9

Hypervisor

App

De-privileged

Kernel

U-Mode

S-Mode

Formal requirements for virtualizable third generation architectures, GJ Popek, RP Goldberg, 1974

Charly Castes | SOSP’25

10 of 22

  • Classical Virtualization

Classical virtualization, also called software virtualisation, relies on trapping and emulating privileged instructions

10

Virtual Firmware Monitor

App

Kernel

De-privileged

Firmware

M-Mode

U-Mode

S-Mode

Charly Castes | SOSP’25

11 of 22

  • The Virtualization Criteria

The Popek & Goldberg virtualization requirements [1]:

An ISA is virtualizable if all sensitive instructions are privileged.

After a review of the main ISAs:

  • RISC-V: M-mode is virtualizable
  • Arm: EL3 is not virtualizable (but can be easily fixed)
  • x86_64: SMM is not virtualizable

11

[1]: Formal requirements for virtualizable third generation architectures, GJ Popek, RP Goldberg, 1974

Charly Castes | SOSP’25

12 of 22

Miralis

13 of 22

The Miralis Virtual Firmware Monitor

Simpler than an hypervisor:

  • No multiplexing
  • Simpler firmware features
  • Minimal virtual devices

13

Firmware

App

Kernel

U-Mode

S-Mode

M-Mode

Miralis is 6.2K lines of Rust, and runs un-modified firmware in user-space

Charly Castes | SOSP’25

14 of 22

The Miralis Virtual Firmware Monitor

14

Miralis supports 3 different platforms with unmodified vendor firmware:

  • Premier P550
  • VisionFive 2
  • Star64

~1 trap/s

Charly Castes | SOSP’25

15 of 22

The Miralis Virtual Firmware Monitor

15

Firmware

App

Kernel

U-Mode

S-Mode

M-Mode

Enclave

Runtime

Miralis can be extended with isolation policies

+

Charly Castes | SOSP’25

16 of 22

Lightweight VFM Verification

16

17 of 22

Lightweight VFM Verification

Virtual firmware monitors are especially good targets for automated verification.

On Miralis, we verified:

  • Instruction emulation
  • Interrupt delivery
  • Memory protection

17

Charly Castes | SOSP’25

18 of 22

Lightweight VFM Verification

We use the official RISC-V specification that we automatically translate into a RISC-V Rust model

Official Spec (Sail)

Rust Model

18

Charly Castes | SOSP’25

19 of 22

Lightweight VFM Verification

The Rust model can be used to verify the result of the Miralis emulator

19

R i

R’

R’’

≃?

With symbolic execution we can prove the correctness of the emulator (43.5% of the code base)

Charly Castes | SOSP’25

20 of 22

The Design and Implementation of a

Virtual Firmware Monitor

Firmware is a security liability.

On virtualizable architectures, firmware can be efficiently de-privileged.

Miralis is a RISC-V Virtual Firmware Monitor. It supports un-modified firmware, has no measurable performance overhead, and has a small TCB.

See SOSP’25 paper for details!

20

Charly Castes | SOSP’25

21 of 22

Lightweight VFM Verification - Bugs

Example: memory protection

21

Charly Castes | SOSP’25

22 of 22

Lightweight VFM Verification - Bugs

Example: adding new extensions

22

Charly Castes | SOSP’25