gulfstream
play

Gulfstream Staged Sta4c Analysis for Streaming JavaScript - PowerPoint PPT Presentation

Gulfstream Staged Sta4c Analysis for Streaming JavaScript Applica4ons Salvatore Guarnieri Ben Livshits University of Washington Microso3 Research Web applica4on


  1. Gulfstream ¡ Staged ¡Sta4c ¡Analysis ¡for ¡Streaming ¡JavaScript ¡Applica4ons ¡ Salvatore ¡Guarnieri ¡ Ben ¡Livshits ¡ University ¡of ¡Washington ¡ Microso3 ¡Research ¡

  2. Web ¡applica4on ¡ Web ¡page ¡ Third ¡Party ¡Server ¡ widget.js ¡ 2 ¡

  3. Safe ¡Code ¡Inclusion ¡In ¡JavaScript ¡ Run8me ¡Enforcement ¡ Sta8c ¡Analysis ¡ • Conscript ¡[Oakland ¡10] ¡ • Gatekeeper ¡[USENIX ¡Sec ¡09] ¡ • BrowserShield ¡[OSDI ¡06] ¡ • Staged ¡Informa4on ¡flow ¡for ¡ JavaScript ¡[PLDI ¡09] ¡ • Caja ¡ Whole ¡program ¡analysis ¡approaches ¡require ¡ the ¡en4re ¡program ¡ 3 ¡

  4. 4 ¡

  5. JavaScript ¡programs ¡are ¡streaming ¡ 5 ¡

  6. Script ¡Crea8on ¡ <HTML> � <HEAD> � <SCRIPT> � function foo(){...} � var f = foo; � </SCRIPT> � What ¡does ¡f ¡ <SCRIPT> � refer ¡to? ¡ function bar(){...} � if (...) f = bar; � </SCRIPT> � </HEAD> � <BODY onclick="f();"> ...</BODY> � </HTML> � 6 ¡

  7. Incremental ¡Loading ¡in ¡Facebook ¡ 250 ¡ 13 ¡ 200 ¡ 20 ¡ 29 ¡ Profile ¡ 150 ¡ Inbox ¡ KB ¡ Friends ¡ 100 ¡ Home ¡ 157 ¡ 71% ¡ 50 ¡ 0 ¡ 7 ¡

  8. Gulfstream ¡In ¡Ac8on ¡ ✔ ¡ Offline ¡ Online ¡ 8 ¡

  9. Gulfstream ¡In ¡Ac8on ¡ ✔ ¡ ✔ ¡ Offline ¡ Online ¡ 9 ¡

  10. Gulfstream ¡In ¡Ac8on ¡ ✔ ¡ Offline ¡ Online ¡ 10 ¡

  11. Outline ¡ • Mo4va4on ¡ • Implementa4on ¡ • Evalua4on ¡ • Conclusions ¡ 11 ¡

  12. Queries ¡ • We ¡want ¡to ¡determine ¡something ¡about ¡the ¡ program ¡ • Example ¡ – What ¡does ¡f() ¡refer ¡to ¡ – Detect ¡alert ¡calls ¡ – Does ¡this ¡program ¡use ¡setTimeout ¡ 12 ¡

  13. Points-­‑To ¡Analysis ¡ • Provides ¡deep ¡program ¡understanding ¡ • Can ¡be ¡used ¡to ¡construct ¡call ¡graphs ¡ • Is ¡the ¡founda4on ¡of ¡further ¡analyses ¡ • Answers ¡a ¡simple ¡ques4on: ¡What ¡heap ¡ loca4ons ¡does ¡ ¡variable ¡ x ¡point ¡to ¡ 13 ¡

  14. Points-­‑To ¡Example ¡ !" !# !$ !% !& /00 ' ) * ( +,-.# 314 122 +,-." +,-.% 1. var A = new Object(); 2. var B = new Object(); 145# 145" 3. x = new Object(); 4. x.foo = new Object(); 5. y = new Object(); 6. y.bar = x; 7. y.add = function(a, b) {} 8. y.add(A, B) 14 ¡

  15. Implementa8on ¡Strategies ¡ Datalog ¡with ¡bddbddb ¡ Graph-­‑based ¡flow ¡analysis ¡ + ¡Fast ¡for ¡large ¡programs ¡ + ¡Very ¡small ¡startup ¡cost ¡ + ¡Highly ¡tuned ¡ + ¡Customized ¡to ¡work ¡with ¡ Gulfstream ¡ -­‑ ¡Large ¡startup ¡cost ¡ -­‑ ¡Does ¡not ¡scale ¡well ¡ -­‑ ¡Difficult ¡to ¡implement ¡in ¡the ¡ browser ¡ • Used ¡in ¡Gatekeeper ¡[USENIX ¡ Sec ¡09] ¡ 15 ¡

  16. Implementa8on ¡ • Normalize ¡JavaScript ¡ – Turn ¡program ¡into ¡a ¡series ¡of ¡simple ¡statements ¡ – Introduce ¡temporaries ¡as ¡necessary ¡ • Create ¡flow ¡graph ¡– ¡Use ¡normalized ¡program ¡ to ¡generate ¡flow ¡constraints ¡ • Serialize ¡flow ¡graph ¡– ¡Encode ¡the ¡flow-­‑graph ¡ so ¡online ¡analysis ¡can ¡use ¡it ¡to ¡update ¡results ¡ 16 ¡

  17. Implementa8on ¡Con8nued ¡ • Perform ¡points-­‑to ¡analysis ¡ – Traverse ¡flow ¡graph ¡to ¡find ¡all ¡aliases ¡ – Follow ¡flow ¡through ¡method ¡boundaries ¡ – Generate ¡points-­‑to ¡map ¡for ¡queries ¡to ¡use ¡ • Queries ¡– ¡Use ¡points-­‑to ¡data ¡and ¡flow ¡graph ¡to ¡ answer ¡queries ¡ 17 ¡

  18. Evalua8on ¡ • Ques4on ¡– ¡Is ¡Gulfstream ¡faster ¡than ¡non-­‑staged ¡ analysis ¡ • Benchmarks ¡ – Synthe4cally ¡generated ¡ – Scraped ¡from ¡Google ¡code ¡ – Scraped ¡from ¡Facebook ¡ • Simulate ¡diverse ¡environments ¡ – CPU ¡speed ¡and ¡network ¡proper4es ¡ – Cell ¡phone, ¡laptop, ¡desktop, ¡etc. ¡ 18 ¡

  19. Laptop ¡Running ¡Time ¡Comparison ¡ Gulfstream ¡ Full ¡Analysis ¡ bddbddb ¡ 8 ¡ Aner ¡30KB ¡of ¡updates, ¡ 7 ¡ Gulfstream ¡is ¡no ¡longer ¡ 6 ¡ faster ¡ 5 ¡ Seconds ¡ 4 ¡ 3 ¡ 2 ¡ 1 ¡ 0 ¡ 30 ¡ 35 ¡ 40 ¡ 45 ¡ 50 ¡ 55 ¡ 60 ¡ 65 ¡ Total ¡Page ¡Size ¡(KB) ¡ 19 ¡

  20. Simulated ¡Devices ¡ • Low ¡power ¡mobile ¡ • High ¡power ¡ 20 ¡

  21. Simulated ¡Devices ¡ • Low ¡power ¡mobile ¡ • High ¡power ¡ 21 ¡

  22. Lessons ¡Learned ¡ • Slow ¡devices ¡ benefit ¡from ¡Gulfstream ¡ • A ¡ slow ¡network ¡ can ¡negate ¡the ¡benefits ¡of ¡the ¡ staged ¡analysis ¡ • Large ¡page ¡updates ¡ don’t ¡benefit ¡from ¡ Gulfstream ¡ 22 ¡

  23. Facebook ¡Experiment ¡ • Visit ¡4 ¡pages ¡ – Home ¡ – Friends ¡ – Inbox ¡ – Profile ¡ • Each ¡page ¡loads ¡addi4onal ¡JavaScript ¡ 23 ¡

  24. Gulfstream ¡Savings: ¡Slow ¡Devices ¡ 350 ¡ 300 ¡ 250 ¡ profile ¡ ¡ Seconds ¡ 200 ¡ inbox ¡ ¡ friends ¡ ¡ 150 ¡ home ¡ ¡ 100 ¡ 50 ¡ 0 ¡ 24 ¡

  25. Gulfstream ¡Savings: ¡Fast ¡Devices ¡ 12 ¡ 10 ¡seconds ¡ saved ¡ 10 ¡ 8 ¡ profile ¡ ¡ Seconds ¡ inbox ¡ ¡ 6 ¡ friends ¡ ¡ home ¡ ¡ 4 ¡ 2 ¡ 0 ¡ 25 ¡

  26. Conclusion ¡ • Gulfstream, ¡staged ¡analysis ¡for ¡JavaScript ¡ • Staged ¡analysis ¡ – Offline ¡on ¡the ¡server ¡ – Online ¡in ¡the ¡browser ¡ • Wide ¡range ¡of ¡experiments ¡ – For ¡small ¡updates, ¡Gulfstream ¡is ¡faster ¡ – Devices ¡with ¡slow ¡CPU ¡benefit ¡most ¡ 26 ¡

  27. The ¡End ¡ • Contact: ¡salvatore.guarnieri@gmail.com ¡ 27 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend