The Construction and Applications of Callback Control Flow Graphs for Event-Driven and Framework-Based Mobile Apps Danilo Dominguez Perez Iowa State University
Total Page:16
File Type:pdf, Size:1020Kb
Iowa State University Capstones, Theses and Graduate Theses and Dissertations Dissertations 2019 The construction and applications of callback control flow graphs for event-driven and framework-based mobile apps Danilo Dominguez Perez Iowa State University Follow this and additional works at: https://lib.dr.iastate.edu/etd Part of the Computer Sciences Commons Recommended Citation Dominguez Perez, Danilo, "The onc struction and applications of callback control flow graphs for event-driven and framework-based mobile apps" (2019). Graduate Theses and Dissertations. 17004. https://lib.dr.iastate.edu/etd/17004 This Dissertation is brought to you for free and open access by the Iowa State University Capstones, Theses and Dissertations at Iowa State University Digital Repository. It has been accepted for inclusion in Graduate Theses and Dissertations by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. The construction and applications of callback control flow graphs for event-driven and framework-based mobile apps by Danilo Dominguez Perez A dissertation submitted to the graduate faculty in partial fulfillment of the requirements for the degree of DOCTOR OF PHILOSOPHY Major: Computer Science Program of Study Committee: Wei Le, Major Professor Hridesh Rajan Samik Basu Robyn Lutz Wensheng Zhang The student author, whose presentation of the scholarship herein was approved by the program of study committee, is solely responsible for the content of this dissertation. The Graduate College will ensure this dissertation is globally accessible and will not permit alterations after a degree is conferred. Iowa State University Ames, Iowa 2019 Copyright c Danilo Dominguez Perez, 2019. All rights reserved. ii DEDICATION I would like to dedicate this thesis to my son Evan and my wife Dayiris without whose support I would not have been able to complete this work. Dayiris, you supported my dream and were always for me every time I needed you. I would also like to thank my friends and family for their loving guidance during the writing of this work. iii TABLE OF CONTENTS Page LIST OF TABLES . vi LIST OF FIGURES . vii ACKNOWLEDGEMENTS . viii ABSTRACT . ix CHAPTER 1. INTRODUCTION . .1 1.1 Contributions . .3 1.2 Outline . .4 CHAPTER 2. PREDICATE CALLBACK SUMMARIES . .5 2.1 Defining PCS . .5 2.2 Computing PCS . .8 2.2.1 Identifying Callback Nodes . .8 2.2.2 Computing Predicate Nodes . 11 2.2.3 Computing Update Nodes . 14 2.2.4 Generating Summary Graphs . 15 2.3 Applying PCS . 16 2.4 Experimental Results . 17 2.4.1 Experimental Setup . 17 2.4.2 Compactness of the Summaries . 18 2.4.3 Correctness of the Summaries . 19 2.4.4 Scalability of Generating the Summaries . 20 2.4.5 Constructing Apps' inter-callback CFGs with PCSs . 21 iv 2.5 Discussion . 23 2.6 Summary . 24 CHAPTER 3. SPECIFYING CALLBACK CONTROL FLOW OF ANDROID APPS US- ING FINITE AUTOMATA . 25 3.1 An Overview . 26 3.1.1 What is a CCFA . 27 3.1.2 How to Compute a CCFA . 28 3.2 Callback Control Flow Automata . 29 3.2.1 Definition . 30 3.2.2 The Scope of CCFAs . 32 3.3 Computing a CCFA . 33 3.4 Program Analysis using CCFAs . 39 3.4.1 First Approach . 39 3.4.2 Second Approach . 42 3.5 Evaluation . 43 3.5.1 Implementation and Experimental Setup . 43 3.5.2 Performance . 44 3.5.3 Callback Coverage . 45 3.5.4 Information Flow Analysis . 47 3.5.5 Value-Flow Analysis for Source-Sink Pairs . 50 3.6 Discussions . 51 3.7 Summary . 53 CHAPTER 4. TESTING COVERAGE CRITERIA FOR MOBILE APPS BASED ON CALL- BACK SEQUENCES . 54 4.1 Motivation . 56 4.2 Designing Test Criteria Based on Callback Interactions . 57 v 4.2.1 Specifying Callback Sequences Using CCFA . 59 4.2.2 What important callback sequences we should test? . 59 4.2.3 Testing Criteria Based on Callback Sequences . 62 4.3 Measuring Test Coverage . 66 4.3.1 The Framework for Measuring C1, C2 and C3 . 66 4.3.2 Measuring Coverage for C1 . 68 4.3.3 Measuring Coverage for C2 . 69 4.3.4 Measuring Coverage for C3 . 70 4.4 Evaluation . 72 4.4.1 Implementation and Experimental Setup . 72 4.4.2 Results for RQ1 . 74 4.4.3 Results for RQ2 . 76 4.4.4 Results for RQ3 . 77 4.5 Summary . 78 CHAPTER 5. RELATED WORK . 80 CHAPTER 6. CONCLUSIONS AND FUTURE WORK . 84 6.1 Future Work . 85 6.1.1 Use of CCFA for different Analyses and Domains . 85 6.1.2 Coverage Guided Input Generation for Mobile Apps . 85 6.1.3 Extension of CCFAs . 85 BIBLIOGRAPHY . 86 vi LIST OF TABLES Page Table 2.1 Matching Predicate Nodes and Update Nodes . 14 Table 2.2 Size of ICFGs versus Size of Summary Graphs . 19 Table 2.3 Comparison to Manually Identified Ground Truths . 20 Table 2.4 Constructing Apps' inter-callback ICFGs Using PCSs . 21 Table 2.5 Compare Dynamic Traces and Static Paths . 22 Table 3.1 Performance of Computing CCFAs . 46 Table 3.2 FLOWDROID on lifecycle model and on CCFA . 48 Table 3.3 Information Flow Analysis on DroidBench . 50 Table 3.4 Global Source Sink Pairs . 52 Table 4.1 Dataflow between callbacks. EV: event callback, AS: API SYNC call- back, AA: API ASYNC callback . 60 Table 4.2 Bug study results. EV: event callback, AS: API SYNC callback, AA: API ASYNC callback . 61 Table 4.3 Benchmark Apps . 73 Table 4.4 The bugs found and their correlations with the increases of the test criteria . 76 Table 4.5 Unique crashes found by both tests, by just manual testing, or by just Monkey . 77 Table 4.6 Coverage of C1, C2 and C3 using manual testing and Monkey . 78 Table 4.7 Compare the time used to trigger the bugs . 78 vii LIST OF FIGURES Page Figure 2.1 Source code for LoaderManager.initLoader ...............7 Figure 2.2 An Overview of Lithium . .9 Figure 2.3 handleMessage in ActivityThreadHandler . 10 Figure 2.4 Scalability of Lithium . 21 Figure 3.1 Source code, CCFA, WTG and PCS of an example app . 26 Figure 3.2 An Overview of the Approach . 28 Figure 3.3 Guard for sendMessage ........................ 32 Figure 4.1 Motivating examples using real world apps chanu and FileDown- loader. We present a fragment of the code that is significant to the bug and the possible sequences of callbacks in the fragment that can be executed at runtime . 58 Figure 4.2 An app with Location Callbacks . 63 Figure 4.3 The Framework for Measuring Coverage . 66 Figure 4.4 The CCFA for the code shown in Figure 4.1a............. 70 Figure 4.5 Coverage over time for Pedometer and Movie DB . 75 viii ACKNOWLEDGEMENTS I would like to thank my advisor Wei Le for her support and guidance to help me become a researcher. Professor Le was.