Quietus: Detecting False Finality in DMA Buffer Reclamation
Samarth Narang, Brandon Reagen
cs.OS
Dec 3, 2026 · v1
cs.SE
TL;DR
Defines a DMA buffer finality operational semantics in Lean and proves sound and complete an executable checker that is run in the Lean kernel on driver lifecycle models.
Abstract
Direct memory access (DMA) lets devices read and write memory independently of the CPU, so a driver can safely hand a buffer to a new owner only after every operation that can access that memory has finished. In practice, however, drivers often release or reuse buffers right after requesting a stop or observing a single completion event, which lets queued descriptors, asynchronous completion callbacks, or deferred bounce-buffer copybacks outlive that handoff and overwrite memory that now belongs to the new owner. We call this failure false finality, and catching it requires tracking operations across execution contexts while accounting for the actual retirement guarantees of the underlying DMA provider. We present QUIETUS, a framework that detects unsafe DMA buffer reclamation by checking authority-set finality, the requirement that no hardware or software operation from a buffer's previous use can still access it once a new owner takes over. We formalize this property in Lean and build a verified checker that analyzes reconstructed driver lifecycles using each DMA provider's retirement guarantees. The checker shows how each reported violation occurs within the model and establishes safe retirement only when every modeled path is safe. We applied QUIETUS to Linux and Zephyr and uncovered 32 machine-checked DMA lifecycle violations across 29 drivers, and reproduced representative violations on physical hardware and in kernel emulation, demonstrating writes into a new owner's memory on embedded hardware and use-after-free writes in Linux.
Problem
Device drivers often free or reuse DMA buffers after only requesting a stop or seeing a single completion event. Queued descriptors, completion callbacks, or bounce-buffer copybacks can then write into memory that now belongs to a new owner. This failure, called false finality, requires tracking operations across execution contexts and accounting for the DMA provider's actual retirement guarantees.
Approach
QUIETUS defines authority-set finality in a Lean operational semantics. The semantics tracks memory regions with ownership epochs and three kinds of access authority: device (hardware transfers), software (completion callbacks), and finalizer (bounce-buffer copybacks). A deterministic Lean checker is proved sound and complete against the semantics, and finality is proved necessary and sufficient to prevent stale accesses. Lifecycle models come from Linux and Zephyr C drivers, either extracted automatically by a frontend or written by hand, and source review validates the model premises.
Results
Across 29 drivers, QUIETUS found 32 machine-checked DMA lifecycle violations: 28 in 25 Linux drivers and 4 in 4 Zephyr drivers. Representative bugs were reproduced on hardware and in emulation, including cross-owner overwrites on an STM32 board and KASAN-detected use-after-free writes in Linux.
| Root cause | Linux | Zephyr |
|---|
| Stop requested, not awaited | 8 | 2 |
| Issued DMA not stopped | 7 | 0 |
| Completion after FIFO reset | 5 | 0 |
| Unmap precedes DMA stop | 4 | 0 |
| Total (all causes) | 28 | 4 |
Root causes of the 32 DMA lifecycle findings (selected rows)