Race detection for Android applications

Programming environments for smartphones expose a concurrency model that combines multi-threading and asynchronous event-based dispatch. While this enables the development of efficient and feature-rich applications, unforeseen thread interleavings coupled with non-deterministic reorderings of asynchronous tasks can lead to subtle concurrency errors in the applications. In this paper, we formalize the concurrency semantics of the Android programming model. We further define the happens-before relation for Android applications, and develop a dynamic race detection technique based on this relation. Our relation generalizes the so far independently studied happens-before relations for multi-threaded programs and single-threaded event-driven programs. Additionally, our race detection technique uses a model of the Android runtime environment to reduce false positives. We have implemented a tool called DroidRacer. It generates execution traces by systematically testing Android applications and detects data races by computing the happens-before relation on the traces. We analyzed 15 Android applications including popular applications such as Facebook, Twitter and K-9 Mail. Our results indicate that data races are prevalent in Android applications, and that DroidRacer is an effective tool to identify data races.

[1]  Porfirio Tramontana,et al.  Using GUI ripping for automated testing of Android applications , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[2]  NaikMayur,et al.  Effective static race detection for Java , 2006 .

[3]  Dawson R. Engler,et al.  RacerX: effective, static detection of race conditions and deadlocks , 2003, SOSP '03.

[4]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[5]  Yun Zhang,et al.  Static data race detection for concurrent programs with asynchronous calls , 2009, ESEC/FSE '09.

[6]  Manu Sridharan,et al.  Effective race detection for event-driven programs , 2013, OOPSLA.

[7]  Damien Zufferey,et al.  P: safe asynchronous event-driven programming , 2013, PLDI.

[8]  Manu Sridharan,et al.  Race detection for web applications , 2012, PLDI.

[9]  Mayur Naik,et al.  Dynodroid: an input generation system for Android apps , 2013, ESEC/FSE 2013.

[10]  Michael Hicks,et al.  LOCKSMITH: Practical static race detection for C , 2011, TOPL.

[11]  Horatiu Jula,et al.  Platform-wide deadlock immunity for mobile phones , 2011, 2011 IEEE/IFIP 41st International Conference on Dependable Systems and Networks Workshops (DSN-W).

[12]  Michael D. Ernst,et al.  Finding errors in multithreaded GUI applications , 2012, ISSTA 2012.

[13]  Leslie Lamport,et al.  Time, clocks, and the ordering of events in a distributed system , 1978, CACM.

[14]  Assaf Schuster,et al.  Toward Integration of Data Race Detection in DSM Systems , 1999, J. Parallel Distributed Comput..

[15]  Sorin Lerner,et al.  RELAY: static race detection on millions of lines of code , 2007, ESEC-FSE '07.

[16]  Xiangyu Zhang,et al.  Statically locating web application bugs caused by asynchronous calls , 2011, WWW.

[17]  Rupak Majumdar,et al.  Algorithmic verification of asynchronous programs , 2010, TOPL.

[18]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[19]  Adam Dunkels,et al.  Contiki - a lightweight and flexible operating system for tiny networked sensors , 2004, 29th Annual IEEE International Conference on Local Computer Networks.

[20]  Satish Narayanasamy,et al.  Detecting and surviving data races using complementary schedules , 2011, SOSP.

[21]  Willy Zwaenepoel,et al.  Flash: An efficient and portable Web server , 1999, USENIX Annual Technical Conference, General Track.

[22]  R. Bodík,et al.  Concurrency Concerns in Rich Internet Applications , 2009 .

[23]  Martin Wirsing,et al.  An Event-Based Structural Operational Semantics of Multi-Threaded Java , 1999, Formal Syntax and Semantics of Java.

[24]  Alexander Aiken,et al.  Effective static race detection for Java , 2006, PLDI '06.

[25]  Andreas Ritter Formal Syntax And Semantics Of Java , 2016 .

[26]  Ramesh Govindan,et al.  TOSThreads: thread-safe and non-invasive preemption in TinyOS , 2009, SenSys '09.

[27]  Assaf Schuster,et al.  MultiRace: efficient on‐the‐fly data race detection in multithreaded C++ programs , 2007, Concurr. Comput. Pract. Exp..

[28]  Jim Alves-Foss,et al.  Formal Syntax and Semantics of Java , 2002, Lecture Notes in Computer Science.

[29]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[30]  Assaf Schuster,et al.  Efficient on-the-fly data race detection in multithreaded C++ programs , 2003, PPoPP '03.

[31]  Stephen N. Freund,et al.  FastTrack: efficient and precise dynamic race detection , 2009, PLDI '09.

[32]  Jong-Deok Choi,et al.  Hybrid dynamic data race detection , 2003, PPoPP '03.