Automatic Fault Injection for Driver Robustness Testing

Automatic Fault Injection for Driver Robustness Testing

Automatic Fault Injection for Driver Robustness Testing Kai Cong, Li Lei, Zhenkun Yang, and Fei Xie Department of Computer Science, Portland State University, Portland, OR 97207, USA {congkai, leil, zhenkun, xie}@cs.pdx.edu ABSTRACT critical to conduct such robustness testing to improve driver Robustness testing is a crucial stage in the device driver reliability. However, such corner cases are usually difficult to development cycle. To accelerate driver robustness testing, trigger when testing drivers. The time-to-market pressure effective fault scenarios need to be generated and injected further exacerbates the problem by limiting the time allo- without requiring much time and human effort. In this pa- cated for driver testing [30]. Thus, it is highly desirable to per, we present a practical approach to automatic runtime speed-up driver robustness testing and reduce human effort. generation and injection of fault scenarios for driver robust- Fault injection is a technique for software robustness test- ness testing. We identify target functions that can fail from ing by introducing faults to test code paths, in particular runtime execution traces, generate effective fault scenarios error handling code paths, that might otherwise rarely be on these target functions using a bounded trace-based it- traversed. Recently, fault injection techniques have been erative strategy, and inject the generated fault scenarios at widely used for software testing [21, 24]. These techniques runtime to test driver robustness using a permutation-based have major potential to play a crucial role in driver robust- injection mechanism. We have evaluated our approach on ness testing. 12 Linux device drivers and found 28 severe bugs. All these Our approach is inspired by Linux Fault Injection Infras- bugs have been further validated via manual fault injection. tructure (LFII) [19] which has been integrated into the Linux The results demonstrate that our approach is useful and kernel since Version 2.6.19. LFII can cause system faults, efficient in generating fault scenarios for driver robustness such as memory allocation functions returning errors, for testing with little manual effort. system robustness testing. Our concept of faults is consis- tent with that of LFII. There are also other similar studies focusing on fault injection techniques for driver robustness Categories and Subject Descriptors testing [27, 34]. However, these approaches and tools have C.4 [Performance of Systems]: Fault tolerance; D.2.5 obvious limitations. First, they only provide basic frame- [Testing and Debugging]: Error handling and recovery works which mainly support low memory situations. Sec- ond, they only support random fault injection which is hard to control and inefficient. Third, they require much human General Terms effort and time to get good results and are not easy-to-use. Experimentation This demands an innovative approach to systematic and ef- fective fault generation and injection for driver robustness Keywords testing. We have developed an approach to automatic runtime Fault Injection, Fault Scenario Generation, Driver Robust- fault generation and injection for driver robustness testing. ness Testing Our approach runs a driver test and collects the correspond- ing runtime trace. Then we identify target functions which 1. INTRODUCTION can fail from the captured trace, and generate effective fault Robustness testing is a crucial stage in the device driver scenarios on these target functions. Each generated fault development cycle. Device drivers may behave correctly in scenario includes a fault configuration which is applied to normal system environments, but fail to handle corner cases guide further fault injection. Each fault scenario is applied when experiencing system errors, such as low resource situa- to guide one instance of runtime fault injection and gener- tions, PCI bus errors and DMA failures [32]. Therefore, it is ate further fault scenarios. This process is repeated until all fault scenarios have been tested. To achieve systematic and effective fault injection, we have developed two key strategies. First, a bounded trace-based iterative generation Permission to make digital or hard copies of all or part of this work for strategy is developed for generating effective fault scenarios. personal or classroom use is granted without fee provided that copies are Second, a permutation-based injection strategy is developed not made or distributed for profit or commercial advantage and that copies to assure the fidelity of runtime fault injection. bear this notice and the full citation on the first page. To copy otherwise, to We have implemented our approach in a prototype driver republish, to post on servers or to redistribute to lists, requires prior specific robustness testing tool, namely, ADFI (Automatic Driver permission and/or a fee. ISSTA’15 , July 12–17, 2015, Baltimore, MD, USA Fault Injection). ADFI has been applied to 12 widely-used Copyright 2015 ACM 978-1-4503-3620-8/15/07 ...$15.00. device drivers. ADFI generated thousands of fault scenarios returned pointer is directly used without null pointer check- and injected them at runtime automatically. After applying ing. Under normal system conditions, the kmalloc function all these generated fault scenarios to driver testing, ADFI returns successfully with a correct pointer to the allocat- detected 28 severe driver bugs. Among these bugs, 8 bugs ed memory. However, when the kmalloc function returns a are caused by low resource situations, 8 bugs are caused by null pointer under a low resource situation, it is possible for PCI bus errors, 8 bugs are caused by DMA failures and the the driver to crash the system. To handle such errors, the other 4 bugs are caused by mixed situations. common approach is to add an error handling mechanism. Our research makes the following three key contributions: 1)Automatic Fault Injection. Our approach to driver int *p=(int *)kmalloc(size, GFP_ATOMIC); if(!p) goto error; robustness testing not only enables runtime fault injection p[10] = 3; to simulate system errors, but also generates fault scenarios ...... automatically based on the runtime trace to exercise possible error: error_handler(); error conditions of a driver efficiently. Our approach is easy to use and requires minimum manual efforts, which greatly reduces driver testing costs and accelerates testing process. Figure 2: An example with error handler 2)Bounded Trace-based Iterative Generation Strat- AsshowninFigure2,afterthekmalloc function returns, egy. A bounded trace-based iterative generation strategy the code checks whether the return value is a null pointer . If is developed to generate unique and effective fault scenar- the kmalloc function returns a null pointer, the correspond- ios based on runtime traces. This strategy not only gener- ing error handler is invoked to handle the error. However, ates effective fault scenarios covering different kinds of error a further concern is whether the error is handled correctly situations in modest time, but also produces efficient fault and does not trigger other driver or system errors. scenarios with no redundancy. To improve driver robustness, a device driver should be 3)Permutation-based Replay Mechanism. To assure tested to see whether there exist two kinds of bugs: (1) the fidelity of runtime fault injection with generated fault driver error handling code does not exist; (2) driver error scenarios, a permutation-based replay mechanism is devel- handling mechanisms do not handle the error correctly or oped to handle software concurrency and runtime uncertain- trigger other driver/system issues. The first kind seems to be ty. The mechanism guarantees that the same driver behav- easy to avoid as long as driver developers write and check the iors can be triggered using the same fault scenario repeatedly code carefully. However, it still happens in the real world. at runtime. The second kind is usually difficult and expensive to test. The remainder of this paper is structured as follows. Sec- 2.2 Runtime Driver Fault Injection tion 2 provides the background. Sections 3 and 4 present In driver robustness testing, all possible error conditions the design of our approach. Section 5 discusses its imple- of a driver ought to be exercised. However, certain error mentation. Section 6 elaborates on the case studies we have conditions might be difficult and expensive to trigger, but conducted and discusses the experimental results. Section 7 efforts should be made to force or to simulate such errors to reviews related work. Section 8 concludes our work. test the driver. Fault injection is a technique for software ro- bustness testing by introducing faults to test code paths, in 2. BACKGROUND particular error handling code paths that, otherwise, might rarely be followed. Recently, fault injection techniques have 2.1 Driver Robustness Testing been widely explored and studied for software testing and According to the IEEE standard [1], robustness is de- system robustness testing. fined as the degree to which a system operates correctly in the presence of exceptional inputs or stressful environmen- void * kmalloc(size t size, int flags) { tal conditions in software testing. The goal of robustness // Memory allocation operations testing is to develop test cases and test environments where } the robustness of a system can be assessed. void * kmalloc_fault(size t size, int flags) { Kernel modules, especially device drivers, play a critical return NULL; role in operating systems. It is important to

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 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