defdroid: towards a more defensive mobile os against ...huang/talk/defdroid_talk.pdf · mobile apps...

49
DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior Peng (Ryan) Huang, Tianyin Xu, Xinxin Jin, Yuanyuan Zhou UC San Diego http://defdroid.org

Upload: others

Post on 05-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior

Peng (Ryan) Huang, Tianyin Xu, Xinxin Jin, Yuanyuan Zhou

UC San Diego

http://defdroid.org

Page 2: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Growing number of (novice) app developers

2

Page 3: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Mobile apps often less mature

3

Platform Avg.age %ofappsbyindividualdevelopers

AppStore 2.5years >12%

GooglePlay 1.5years >5%

Application History

MySQL 19years

Firefox 12years

Chrome 7years

Top 1,000 mobile apps Popular desktop applications

Page 4: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Page 5: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Battery drain

Page 6: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storageBattery drain

Page 7: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storage

Data hog

Battery drain

Page 8: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storage

Data hogNoisy notifications

Battery drain

Page 9: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Our main contributions» A characteristics study on disruptive app behavior problem

» An OS-level solution to curb disruptive apps at runtime

5

Page 10: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Talk outline» Background

» Understand disruptive app behavior

» DefDroid: curb disruptive app behavior at runtime

6

Page 11: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Data collection

7

open-source project issue trackers

user forums

9,000+ initial cases

app issue complaints

crash, ANR,feature bug 287 DAB cases

182 unique apps

Page 12: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

8

Example of disruptive app behavior

App Version Disruptivebehavior

ownCloud 1.5.4 Syncwithservertoooftenandrequestalotofinfo,batterydrain,datahog

WHERE 3.2.1 ContinuouslyuseGPSonstandby,drainingbattery

F-Droid 0.72 Create“infinite”copiesofXMLfilesduetoabug,eatingupstorage

DAVDroid 0.6 Synclotsofhighresolutioncontactpictures,datahog

Facebook 40.0 CPUspininnetworkhandling,leakingaudiosession,drainingbattery

Chrome 28.0 OveruseGyroscopesensorinbackground,drainingbattery

Page 13: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

8

Example of disruptive app behavior

App Version Disruptivebehavior

ownCloud 1.5.4 Syncwithservertoooftenandrequestalotofinfo,batterydrain,datahog

WHERE 3.2.1 ContinuouslyuseGPSonstandby,drainingbattery

F-Droid 0.72 Create“infinite”copiesofXMLfilesduetoabug,eatingupstorage

DAVDroid 0.6 Synclotsofhighresolutioncontactpictures,datahog

Facebook 40.0 CPUspininnetworkhandling,leakingaudiosession,drainingbattery

Chrome 28.0 OveruseGyroscopesensorinbackground,drainingbattery

Even expert developers can make mistakes

Page 14: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

9

Users often still need to use the apps

This issue makes this program less acceptable to me than Sipdroid. Otherwise, I am happy with the UI and satisfied with stability

-- user comment on a severe battery drain issue in CSipSimple

4.1 out of 5 rating for apps with disruptive behavior in our study

Page 15: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

10

Root causes of DAB are diverse

Refresh widget every 2.5 seconds. Severe battery drain!

Page 16: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

10

Root causes of DAB are diverse

Refresh widget every 2.5 seconds. Severe battery drain!

When users are in environment with poor GPS-signal, it will keep searching for GPS signal!

BetterWeather

Page 17: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Other findings» Common patterns» Triggering conditions» Fix strategy and time

11

Page 18: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

How to deal with disruptive app behavior?

User» difficult to diagnose» difficult to fix

Developer» difficult to ship always-friendly code

OS

12

?

Ordinary

Inexperienced

Page 19: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Talk outline» Background

» Understand disruptive app behavior

» DefDroid: curb disruptive app behavior at runtime

13

Page 20: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

DefDroidGoal» making OS defensive to react to common disruptive app behavior» protect end users from bad experiences

Main challenges» handle a diverse set of disruptive behavior» preserve app main functionality» control overhead

14

Page 21: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Key idea of DefDroid» Monitor important app interactions with OS

15

Resource usage

App internal

OS

API request

Page 22: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints

15

CD

F

0

0.25

0.5

0.75

1

Wakelock session duration (ms)1 100 10000 1000000

99th percentile: 12.2s Max: 15.8min

Page 23: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints» Apply defensive actions at request granularity

15

Page 24: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints» Apply defensive actions at request granularity! enforce exponential back-off! release long-held resource! reduce aggressive update frequency! decrease scheduling priority

15

Page 25: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Extensible defense modules

16

LocationService

NetworkSubsystem

App

Page 26: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Extensible defense modules

16

Micro Monitor Micro Monitor

LocationService

NetworkSubsystem

Defense Module Defense Module

App

…DefDroid

Page 27: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Extensible defense modules

16

Micro Monitor Micro Monitor

LocationService

NetworkSubsystem

Macro Monitor

Controller

Defense Module Defense Module

App

…DefDroid

Page 28: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Page 29: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Page 30: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Length of DefDroid actions

Temporary

Page 31: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Length of DefDroid actions

Temporary

User interfaces

Informative

Page 32: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

DefDroid implementationBuilt on Android 4.4» ported to 5.1» support both AOSP and CM releases

Implemented 11 defense modules» location, wakelock, sensor, alarm, network, etc.

18

Page 33: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Evaluation» How effective is DefDroid in handling real-world DAB?» What is the impact to app usability?» How DefDroid performs in the field?» What is the overhead of DefDroid?

19

Page 34: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Experimental setupDevices» Motorola G, Google Nexus 4

Dataset» 96 real-world DAB cases reproduced from our study» 32 new real-world DAB cases we later collected

20

Page 35: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

21

Overall result

Total Reacted96 94

Total Reacted32 31

Studied DAB cases New DAB cases

Reacted means DefDroid took some actions that lead to positive effect (e.g., reduction in power consumption)

Page 36: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

22

Resource consumption reduction

ResourceReduction

Min Median Max

Energy 130J,6% 340J,21% 866J,87%Cellulardata 17MB,15% 54MB,34% 183MB,86%Storage 30MB,25% 48MB,37% 145MB,90%

30 Minute Experiment Session

Page 37: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Large-scale deployment to PhoneLab» 185 users using Google Nexus 5 running DefDroid» 43 days from 2015/09/21 to 2015/11/3» Took actions on 81 apps in 105 of participants» Reproduced 57 cases» No user complaints about DefDroid breaking app usability

23

http://phone-lab.org

Page 38: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Disruptive behavior found in the field

App Disruptivebehavior

cClock ConstantGPSsearchTheEconomist KeepdisplayonafteruseTWCWiFiFinder Keep(dis)connectingNYTimes ExcessivesensorrequestsSinaNews Long-heldGPSXiami ExcessivewakelockrequestsKik Frequentwake-upphoneZillow Excessivetoasts(notifications)

24

Page 39: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Disruptive behavior found in the field

App Disruptivebehavior

cClock ConstantGPSsearchTheEconomist KeepdisplayonafteruseTWCWiFiFinder Keep(dis)connectingNYTimes ExcessivesensorrequestsSinaNews Long-heldGPSXiami ExcessivewakelockrequestsKik Frequentwake-upphoneZillow Excessivetoasts(notifications)

24

“Biggest issue is the battery drain. This app keeps checking for (hardly) available TWC hotspots, even though I'm already connected to a strong (home/work) wifi. The battery drained from 100% to 15% in 1 to 2 hours.”

Page 40: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Overhead

25

CPUload Memory PowerAndroid 37.5% 1721.9MB 1688.4mWDefDroid 39.2% 1749.8MB 1719.8mW

Overhead 1.7±0.3% 27.9±0.9MB 31.4±7.4mW

Page 41: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Conclusion

26

Disruptive app behavior widely exists in the field, frustrating users

» Problem

» Study Characteristics of 287 real-world issues of disruptive apps

» Solution DefDroid: system-level approach to curb disruptive apps at runtime

» Evaluation real-world cases, deployed to 185 users, found new issues

http://defdroid.org

Page 42: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Limitations» Different DefDroid modules are implemented separately» May overrule user configurations for an app» Policies of defense mechanisms are static» New unknown DAB patterns

27

Page 43: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Mobile apps often less mature

28

Platform Avg.age %ofappsbyindividualdevelopers

AppStore 2.5years >12%

GooglePlay 1.5years >5%

Application History

MySQL 19years

Firefox 12years

Chrome 7years

Top 1,000 mobile apps Popular desktop applications

Page 44: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

MonitorsSystem-level conditions» battery, storage usage, network condition, etc.

App-level activities» important API calls, stats, tokens, etc.

29

caller stats token params

uid/package APIcalltime,frequency

PendingIntent,IBinder,.. flags,tags

To identify potential misbehavior For use by defensive actions

Page 45: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

30

Defensive actions

Actiontype Example

Release releaselong-heldwakelock,GPS

Slowdown enlargealarminterval,reducesensorfrequency

Delay delayexcessivecellularnetworkrequests

Approximate usecoarse-grainedlocation

Downgrade switchtopassiveGPSprovider

Deprioritize decreaseschedulingpriority

Block rejectfrequentalarmrequestsforawhile

Warn warnaboutlargedataconsumption

Kill killnaughtyappprocessesorservices

Page 46: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

Example run of a disruptive app

Page 47: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

32

Common patterns of disruptive app behaviorPattern Cases

Wakelockleakoroveruse 25

GPSleakoroveruse 19

Sensorleakoroveruse 12

Otherresourceleakoroveruse 15

Frequentwake-upalarms 12

Frequentbroadcasts,receivers 6

Aggressivesensor/GPSupdates 15

Frequentconnection,aggressiveretry 44

Excessivecellulardatatransfer 42

Excessivestorageuse 33

HighCPUusage 31

Excessiveorstucknotifications 33

Page 48: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

33

Time to fix for closed DAB issues

Page 49: DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps often less mature 28 Platform Avg. age % of apps by individual developers App Store

34

Impact to app execution

Impact cases

Noimpact 40Deferredexecution 49Failedrequests 31Checkedexceptions 5Termination 0