Angelic Checking Within Static Driver Verifier

Angelic Checking Within Static Driver Verifier

Angelic Checking within Static Driver Verifier: Towards high-precision defects without (modeling) cost Shuvendu K. Lahiri∗, Akash Lal∗, Sridhar Gopinathx, Alexander Nutzz, Vladimir Leviny, Rahul Kumar∗, Nate Deisingery, Jakob Lichtenbergy, and Chetan Bansal∗ ∗Microsoft Research yMicrosoft zUniversity of Freiburg xUniversity of Texas at Austin Abstract—Microsoft’s Static Driver Verifier (SDV) pioneered in debugging. The viewer allows stepping through (interproce- the use of software model checking for ensuring that device dural) counterexample traces reported by the verifier. The trace drivers correctly use operating system (OS) APIs. However, the contains not just control-flow information but also values of verification methodology has been difficult to extend in order to support either (a) new classes of drivers for which SDV doesn’t various variables along the trace. The verification “engine” already have a harness and stubs, or (b) memory-corruption powering the analysis has transformed from SLAM [7] to properties. Any attempt to apply SDV out-of-the-box results in SLAM-2 [8] to YOGI [9] and then finally to Corral [10], [11], either false alarms due to the lack of environment modeling, or each time improving performance, accuracy and scalability. scalability issues when finding deeply nested bugs in the presence SDV establishes a high bar for precision of each of its of a very large number of memory accesses. In this paper, we describe our experience designing and supported rules; typically false-positives rate is below 5% [8]. shipping a new class of checks known as angelic checks through However, despite the decade long investment in the technol- SDV with the aid of angelic verification (AV) [1] technology, ogy and advances in the underlying verification engines [10], over a period of 4 years. AV pairs a precise inter-procedural [12], it has been difficult to adapt the tool to new verification assertion checker with automatic inference of likely specifications for the environment. AV helps compensate for the lack of challenges, even within the world of device drivers. Specifi- environment modeling and regains scalability by making it cally, possible to find deeply nested bugs, even for complex memory- • Memory safety: Checking for memory corruption bugs corruption properties. These new rules have together found over a hundred confirmed defects during internal deployment within the driver code. at Microsoft, including several previously unknown high-impact • Unsupported drivers: Performing verification of DDI potential security vulnerabilities. AV considerably increases the compliance rules for unsupported driver classes whose reach of SDV, both in terms of drivers as well as rules that it frameworks are not modeled accurately by harnesses and can support effectively. stubs. I. INTRODUCTION Memory safety violation is broadly interpreted as an Microsoft’s Static Driver Verifier (SDV) [2], [3] is a formal unchecked invalid access to a piece of memory during a software verification tool that checks Windows device drivers program’s execution. These issues are prevalent in low-level against a set of rules on the correct usage of operating system languages such as C and C++ that trade off performance for (OS) APIs. These Windows OS APIs, which are published automatic memory management overheads. Memory safety on MSDN, and exported for writing Windows drivers are violations can be either (i) temporal, which pertains to a commonly referred to as the Driver Development Interface type-state on a memory address such as being allocated, (DDI) [4]. SDV is shipped to driver developers in the Windows freed, or null, or (ii) spatial, which pertains to checking ecosystem through the Windows Driver Development Kit bounds of an allocated buffer. Such violations can have serious (WDK). Running SDV is a mandated check for a driver to implications on both the reliability and, more importantly, on obtain certification for Windows Server OS [5]. the security of the entire system. Recent studies attribute as Examples of SDV rules range from checking that a driver much as 70% of all security bugs in Microsoft products can calls a DDI function at a particular Interrupt Request Level be attributed to memory safety issues [13]. Static analysis (IRQL), to ensuring that locks are acquired and released tools such as SDV are particularly attractive for the domain of in correct sequence. Given: (a) a rule, written in SDV’s kernel-mode drivers due to the poor coverage of dynamic tools specification language SLIC [6], (b) a harnesses for the driver in this space (because of System issues in setting up dynamic class (e.g. storage or networking) that determines how the tools for kernel-mode components, as well as the large input driver can be invoked by the OS, and (c) stubs for OS DDI space). functions that can be invoked by the driver, SDV uses a On the other hand, SDV currently supports environments software verification tool to look for driver executions that for certain general purpose drivers (WDM, WDF) as well violate the rule. SDV also has a detailed defect viewer to aid as two driver classes (storage, networking). However, there are several important driver classes that SDV doesn’t support, Rule Bugs including file system filters, audio drivers, kernel streaming (in NULLCHECK 68 particular, camera) drivers. For such drivers, SDV environment USEAFTERFREE 7 DOUBLEFETCH 11 is insufficient, which results in partial coverage at best (lack IRQLCHECK 26 of a harness that calls the entry points) and false alarms (as Total 112 DDIs implemented by a driver class library are not modeled Fig. 1. A count of true bugs found by SDV using angelic checks. by stubs). In other words, SDV enjoys a very high precision on the unnecessary because a user can immediately identify the rules and driver classes it supports, but has a relatively poor bug without looking at the rest of the code; this indicates recall (or coverage) on the set of all possible bugs discovered a shortcoming of the SDV approach. in Windows drivers, particularly those that affect memory In this paper, we describe considerably extending the reach safety. In this paper, we therefore focus on the following of SDV through a set of angelic checks. We distinguish these problem in the context of SDV: checks from the currently supported (demonic) checks, where Can we improve the coverage (or recall) of reliabil- the expectation was that SDV would do due diligence to ity and security bugs in Windows drivers using SDV provide accurate harnesses and stubs and also provide full without sacrificing the high precision bar? path coverage for loop-free programs. We observed that we Note that retaining the high precision bar is necessary for can address both the issues of (a) spurious alarms from SDV; customers will push back if SDV slowed down the devel- under-constrained environment, and (b) scalability to find opment process due to the need to deal with spurious alarms. defects in deeply-nested methods, by using angelic verification We are careful to pose the problem as that of “improving the technology [14], [1]. Angelic verification equips a precise coverage” rather than “full coverage” (or ensuring the absence interprocedural verifier (such as Corral) with automatic infer- of) of newer class of defects not detected by SDV. At the ence of likely specifications for the unknowns that correspond same time, it is desirable that the approach be able to leverage to values controlled by the environment. AV suppresses alarms 1 additional modeling (if present) to achieve higher coverage . from the verifier if it can infer a reasonable environment We studied the main technical difficulties to adapt SDV specification to rule out the alarm. Furthermore, because AV to new verification challenges, and narrowed it down to a can also tolerate an unconstrained initial state, AV can start combination of two reasons: exploration from any driver procedure, not just the harness. 1) Precision due to un(der)-constrained environment This is beneficial for catching deeply-nested bugs. models: Creating models for a new class of drivers re- Since the AV technology works on programs written in quires upfront investment that ranges from several weeks Boogie [15], we also developed an instrumentation framework to months of effort and close interaction with domain called AVP for Boogie programs that we use to instrument the experts. Furthermore, even the existing models for DDIs new class of memory safety properties. We have used the new may leave most behaviors unspecified, focussing on just framework to successfully add several angelic checks to SDV the ones that matter for the current set of rules. This is with the goal of realizing the above vision. These include the especially troublesome for memory-safety rules because following: existing models leave out pointer-related behaviors. For 1)N ULLCHECK: checks that a null-valued pointer is not example, it was very common for existing stubs to non- dereferenced, deterministically return a null pointer as output; this 2)U SEAFTERFREE: checks that a freed pointer is not used was fine for existing SDV rules, until we started checking (or freed again), for null-safety and got numerous false alarms. 3)D OUBLEFETCH: checks that a userland pointer is not 2) Scalability: Software verifiers face a path-explosion dereferenced twice in any execution within the ker- problem when large parts of a program cannot be nel [16], abstracted with summaries. Although there has been 4)I RQLCHECK: checks that DDI calls are made only at an progress in performing modular software verification for acceptable IRQL state. simple properties, performing summarization for memory safety with SMT solvers is still an open research problem. The first three rules above pertain to memory safety (or This is primarily due to the need to summarize the state memory corruption) rules. Moreover, a violation of USE- of the heap including state in linked data structures.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us