Precise and Scalable Detection of Double-Fetch Bugs in OS Kernels
Authors:
- Meng XuMXMeng Xu
- Chenxiong QianCQChenxiong Qian
- Kangjie LuKLKangjie Lu
- Michael BackesMBMichael Backes
- Taesoo KimTKTaesoo Kim
- 1 May 2018
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 661-678
Abstract
During system call execution, it is common for operating system kernels to read userspace memory multiple times (multi-reads). A critical bug may exist if the fetched userspace memory is subject to change across these reads, i.e., a race condition, which is known as a double-fetch bug. Prior works have attempted to detect these bugs both statically and dynamically. However, due to their improper assumptions and imprecise definitions regarding double-fetch bugs, their multi-read detection is inherently limited and suffers from significant false positives and false negatives. For example, their approach is unable to support device emulation, inter-procedural analysis, loop handling, etc. More importantly, they completely leave the task of finding real double-fetch bugs from the haystack of multi-reads to manual verification, which is expensive if possible at all. In this paper, we first present a formal and precise definition of double-fetch bugs and then implement a static analysis system - Deadline - to automatically detect double-fetch bugs in OS kernels. Deadline uses static program analysis techniques to systematically find multi-reads throughout the kernel and employs specialized symbolic checking to vet each multi-read for double-fetch bugs. We apply Deadline to Linux and FreeBSD kernels and find 23 new bugs in Linux and one new bug in FreeBSD. We further propose four generic strategies to patch and prevent double-fetch bugs based on our study and the discussion with kernel maintainers.Keywords
This publication has 20 references indexed in Scilit:
- UniSan2016
- Fine-Grained Control-Flow Integrity for Kernel Software2016
- KCoFI: Complete Control-Flow Integrity for Commodity Operating System Kernels2014
- Path-exploration lifting2012
- Satisfiability modulo theoriesCommunications of the ACM, 2011
- RELAY2007
- Understanding collateral evolution in Linux device drivers2006
- Types for safe lockingACM Transactions on Programming Languages and Systems, 2006
- RaceTrack2005
- Correctness of a compiler for arithmetic expressions1967