Lune

USENIX Security2021Top-tier venue

Static Detection of Unsafe DMA Accesses in Device Drivers

Jia-Ju Bai, Tuo Li, Kangjie Lu, Shi-Min Hu

Abstract

Direct Memory Access (DMA) is a popular mechanism for improving hardware I/O performance, and it has been widely used by many existing device drivers. However, DMA accesses can be unsafe, from two aspects. First, without proper synchronization of DMA buffers with hardware registers and CPU cache, the buffer data stored in CPU cache and hardware registers can be inconsistent, which can cause unexpected hardware behaviors. Second, a malfunctioning or untrusted hardware device can write bad data into system memory, which can trigger security bugs (such as buffer overflow and invalid-pointer access), if the driver uses the data without correct validation. To detect unsafe DMA accesses, some key challenges need to be solved. For example, because each DMA access is implemented as a regular variable access in the driver code, identifying DMA accesses is difficult. In this paper, we propose a static-analysis approach named SADA, to automatically and accurately detect unsafe DMA accesses in device drivers. SADA consists of three basic steps. First, SADA uses a field-based alias analysis to identify DMA accesses, according to the information of DMA-buffer creation. Second, SADA uses a flow-sensitive and patternbased analysis to check the safety of each DMA access, to detect possible unsafe DMA accesses. Finally, SADA uses an SMT solver to validate the code-path condition of each possible unsafe DMA access, to drop false positives. We have evaluated SADA on the driver code of Linux 5.6, and found 284 real unsafe DMA accesses. Among them, we highlight that 121 can trigger buffer-overflow bugs and 36 can trigger invalid-pointer accesses causing arbitrary read or write. We have reported these unsafe DMA accesses to Linux driver developers, and 105 of them have been confirmed.

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.

19 top-tier papers have 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

  • Where Does It Go?: Refining Indirect-Call Targets with Multi-Layer Type Analysis cites MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation
  • Saturn: Host-Gadget Synergistic USB Driver Fuzzing cites PrIntFuzz: fuzzing Linux drivers via automated virtual device simulation
  • Saturn: Host-Gadget Synergistic USB Driver Fuzzing cites MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation
  • Saturn: Host-Gadget Synergistic USB Driver Fuzzing cites DIFUZE: Interface Aware Fuzzing for Kernel Drivers
  • PrIntFuzz: fuzzing Linux drivers via automated virtual device simulation cites MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation
  • PrIntFuzz: fuzzing Linux drivers via automated virtual device simulation cites IMF: Inferred Model-based Fuzzer
  • PrIntFuzz: fuzzing Linux drivers via automated virtual device simulation cites DIFUZE: Interface Aware Fuzzing for Kernel Drivers
  • MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation cites IMF: Inferred Model-based Fuzzer
  • Improving Indirect-Call Analysis in LLVM with Type and Data-Flow Co-Analysis cites Where Does It Go?: Refining Indirect-Call Targets with Multi-Layer Type Analysis
  • SyzDirect: Directed Greybox Fuzzing for Linux Kernel cites Where Does It Go?: Refining Indirect-Call Targets with Multi-Layer Type Analysis
  • SyzDirect: Directed Greybox Fuzzing for Linux Kernel cites MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers19

  1. SyzDirect: Directed Greybox Fuzzing for Linux KernelXin Tan, Yuan Zhang, Jiadong Lu, Xin Xiong et al.CCS 2023 · 25 citations
  2. PrIntFuzz: fuzzing Linux drivers via automated virtual device simulationZheyu Ma, Bodong Zhao, Letu Ren, Zheming Li et al.ISSTA 2022 · 23 citations
  3. Saturn: Host-Gadget Synergistic USB Driver FuzzingYiru Xu, Hao Sun, Jianzhong Liu, Yuheng Shen et al.S&P 2024 · 13 citations
  4. Improving Indirect-Call Analysis in LLVM with Type and Data-Flow Co-AnalysisDinghao Liu, Shouling Ji, Kangjie Lu, Qinming HeUSENIX Security 2024 · 13 citations
  5. LR-Miner: Static Race Detection in OS Kernels by Mining Locking RulesTuo Li, Jia-Ju Bai, Gui-Dong Han, Shi-Min HuUSENIX Security 2024 · 6 citations

Builds on16

  1. A2: Analog Malicious HardwareKaiyuan Yang, Matthew Hicks, Qing Dong, Todd M. Austin et al.S&P 2016 · 242 citations
  2. DIFUZE: Interface Aware Fuzzing for Kernel DriversJake Corina, Aravind Machiry, Christopher Salls, Yan Shoshitaishvili et al.CCS 2017 · 195 citations
  3. MoonShine: Optimizing OS Fuzzer Seed Selection with Trace DistillationShankara Pailoor, Andrew Aday, Suman JanaUSENIX Security 2018 · 180 citations
  4. Where Does It Go?: Refining Indirect-Call Targets with Multi-Layer Type AnalysisKangjie Lu, Hong HuCCS 2019 · 142 citations
  5. IMF: Inferred Model-based FuzzerHyungSeok Han, Sang Kil ChaCCS 2017 · 139 citations

Related papers

  1. Dynamic Detection of Vulnerable DMA Race ConditionsBrian Johannesmeyer, Raphael Isemann, Cristiano Giuffrida, Herbert BosCCS 2025
  2. Characterizing, exploiting, and detecting DMA code injection vulnerabilities in the presence of an IOMMUAlex Markuze, Shay Vargaftik, Gil Kupfer, Boris Pismenny et al.EuroSys 2021 · 22 citations
  3. GDMA: Fully Automated DMA Rehosting via Iterative Type OverlaysTobias Scharnowski, Simeon Hoffmann, Moritz Bley, Simon Wörner et al.USENIX Security 2025
  4. DR. CHECKER: A Soundy Analysis for Linux Kernel DriversAravind Machiry, Chad Spensky, Jake Corina, Nick Stephens et al.USENIX Security 2017 · 126 citations
  5. DICE: Automatic Emulation of DMA Input Channels for Dynamic Firmware AnalysisAlejandro Mera, Bo Feng, Long Lu, Engin KirdaS&P 2021 · 81 citations
Dusk over the sea between two cliffs drawn in fine vertical lines