Lune

SOSP2025Top-tier venue

Ghost in the Android Shell: Pragmatic Test-oracle Specification of a Production Hypervisor

Kayvan Memarian, Ben Simner, David Kaloper-Mersinjak, Thibaut Pérami, Peter Sewell

Abstract

Developing systems code that robustly provides its intended security guarantees remains very challenging: conventional practice does not suffice, and full functional verification, while now feasible in some contexts, has substantial barriers to entry and use.

In this paper, we explore an alternative, more lightweight approach to building confidence for a production hypervisor: the pKVM hypervisor developed by Google to protect virtual machines and the Android kernel from each other. The basic approach is very simple and dates back to the 1970s: we specify the desired behaviour in a way that can be used as a test oracle, and check correspondence between that and the implementation at runtime. The setting makes that challenging in several ways: the implementation and specification are intertwined with the underlying architecture; the hypervisor is highly concurrent; the specification has to be loose in certain ways; the hypervisor runs bare-metal in a privileged exception level; naive random testing would quickly crash the whole system; and the hypervisor is written in C using conventional methods. We show how all of these can be overcome to make a practically useful specification, finding a number of critical bugs in pKVM along the way.

This is not at all what conventional developers (nor what formal verifiers) normally do -but we argue that, with the appropriate mindset, they easily could and should.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Formally Verified Memory Protection for a Commodity Multiprocessor Hypervisor cites A Secure and Formally Verified Linux KVM Hypervisor
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. Memclave: Secure In-Memory Enclave for Untrusted HostsAmit Choudhari, Fabian van Rissenbeck, Christian RossowUSENIX Security 2026

Builds on11

  1. Verus: Verifying Rust Programs using Linear Ghost TypesAndrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun et al.OOPSLA 2023 · 86 citations
  2. RefinedC: automating the foundational verification of C code with refined ownership typesMichael Sammler, Rodolphe Lepigre, Robbert Krebbers, Kayvan Memarian et al.PLDI 2021 · 83 citations
  3. A Secure and Formally Verified Linux KVM HypervisorShih-Wei Li, Xupeng Li, Ronghui Gu, Jason Nieh et al.S&P 2021 · 72 citations
  4. Using Lightweight Formal Methods to Validate a Key-Value Storage Node in Amazon S3James Bornholt, Rajeev Joshi, Vytautas Astrauskas, Brendan Cully et al.SOSP 2021 · 63 citations
  5. Formally Verified Memory Protection for a Commodity Multiprocessor HypervisorShih-Wei Li, Xupeng Li, Ronghui Gu, Jason Nieh et al.USENIX Security 2021 · 48 citations

Related papers

  1. CN: Verifying Systems C Code with Separation-Logic Refinement TypesChristopher Pulte, Dhruv C. Makwana, Thomas Sewell, Kayvan Memarian et al.POPL 2023 · 26 citations
  2. Code-Specify-Test-Debug-Prove: Flexibly Integrating Separation Logic Specification into Conventional WorkflowsZain K. Aamer, Rini Banerjee, Hiroyuki Katsura, David Kaloper-Mersinjak et al.PLDI 2026 · 2 citations
  3. überSpark: Enforcing Verifiable Object Abstractions for Automated Compositional Security Analysis of a HypervisorAmit Vasudevan, Sagar Chaki, Petros Maniatis, Limin Jia et al.USENIX Security 2016 · 40 citations
  4. eBPF Misbehavior Detection: Fuzzing with a Specification-Based OracleTao Lyu, Kumar Kartikeya Dwivedi, Thomas Bourgeat, Mathias Payer et al.SOSP 2025
  5. Design of a symbolically executable embedded hypervisorJan NordholzEuroSys 2020 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines