tailored source code transformations to synthesize
play

Tailored Source Code Transformations to Synthesize Computationally - PowerPoint PPT Presentation

Tailored Source Code Transformations to Synthesize Computationally Diverse Program Variants Benoit Baudry, Simon Allier, Martin Monperrus This talk is about the generation of very large quantities of sosie programs sosie programs 2 sosie


  1. Tailored Source Code Transformations to Synthesize Computationally Diverse Program Variants Benoit Baudry, Simon Allier, Martin Monperrus

  2. • This talk is about the generation of very large quantities of sosie programs sosie programs 2

  3. sosie program • Given a specification S 3

  4. sosie program • Given a specification S • Given a program P that conforms to S specified correct behavior bugs, vulnerabilities expected behavior 4

  5. sosie program • Given a specification S • Given a program P that conforms to S • A sosie of P is a variant of P that also conforms to S a sosie 5

  6. Motivation • Explore brittelness vs. plasticity of software • Large quantities of diverse variants • Moving target • Failure detection computation failure diversity 6 diversity

  7. Software brittleness SRSLSLRSRLLSSRRLRL 7 G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)

  8. Software brittleness hypothesis SRSLSLRSRLLSSRRLRL 8 G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)

  9. Software brittleness hypothesis SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL 9 G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)

  10. Software brittleness hypothesis SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL 10 G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)

  11. Software brittleness 11

  12. 12

  13. Software plasticity hypothesis 13

  14. Software plasticity hypothesis Rinard et al. ICSE’10, FSE’11 sosie POPL’12, PLDI’14 SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL 14

  15. Specification: data and properties fun : Function assert abs(fun(.5) - 0.25) < 0.05 assert abs(fun(.4) - 0.16) < 0.05 assert abs(fun(.3) - 0.09) < 0.05 l The test input data specifies the input domain l The assertions specify the level of abstraction

  16. Research questions Do sosies exist? Can we automatically synthesize them? What are effective transformations? 16

  17. Sosiefication process �������� ������������� ��������� ������ �������������� ������������ ������ ��������������� ������������� �������������� ���������� �������������� ���������� ������ ����������� ����������� �� ������ ������������ ������� 17 ������� �������� ����������

  18. Automatic Synthesis of Sosies l We add/deleted/replace a given statement by another one and see whether all assertions remain satisfied l we pick code from the same program l Four strategies l random l wittgenstein: replace with variables that have the same name l reaction: replace with variables that have the same type l steroid: reaction + rename variables

  19. Experimental data #test ¡ compile ¡ test ¡ cases ¡ 1me ¡ 1me ¡ #assert ¡ coverage ¡ #statement ¡ Junit ¡ 721 ¡ 1535 ¡ 82% ¡ 2914 ¡ 4.5 ¡ ¡ 14.4 ¡ EasyMock ¡ ¡ 617 ¡ 924 ¡ 91% ¡ 2042 ¡ 4 ¡ 7.8 ¡ Dagger ¡(core) ¡ ¡ 128 ¡ 210 ¡ 85% ¡ 674 ¡ 5.1 ¡ ¡ 11.2 ¡ JBehave-­‑core ¡ ¡ 485 ¡ 1451 ¡ 89% ¡ 4984 ¡ 5.5 ¡ ¡ 22.9 ¡ Metrics ¡ ¡ 214 ¡ 312 ¡ 79% ¡ 1471 ¡ 4.7 ¡ ¡ 7.7 ¡ commons-­‑ collec1ons ¡ 1121 ¡ 5397 ¡ 84% ¡ 9893 ¡ ¡7.9 ¡ ¡ 22.9 ¡ commons-­‑lang ¡ ¡ 2359 ¡ 13681 ¡ 94% ¡ 11715 ¡ 6.3 ¡ ¡ 24.6 ¡ commons-­‑math ¡ ¡ 3544 ¡ 9559 ¡ 92% ¡ 47065 ¡ 9.2 ¡ ¡ 144.2 ¡ clojure ¡ ¡ NA ¡ ¡ NA ¡ ¡ 71% ¡ 18533 ¡ 105.1 ¡ ¡ 185 ¡ 19

  20. nb of trial: 298938 nb of compile: 81394 nb of sosie: 28805 (10%) don’t compile don’t pass all test cases sosies 20

  21. Computation diversity A.foo() • Goal: unpredictability of execution flow IndexedCollection.retainAll(Collection) • Computation monitoring: AbstractCollectionDecorator.retainAll(Collection) AbstractCollectionDecorator.decorated() • method calls diversity other calls • variable diversity original call IndexedCollection.reindex() sosie call other calls ... 21

  22. Easymock: 465 sosies Dagger: 481 sosies Junit: 446 sosies 22

  23. Conclusion • Sosies exist • for all programs • Sosies can exhibit computation diversity • Next steps • variability-aware execution • is computational diversity unbounded? https://github.com/DIVERSIFY-project/sosies-generator http://diversify-project.eu/sosiefied-programs/ 23

  24. References • Zeyuan Allen Zhu, Sasa Misailovic, Jonathan A. Kelner, Martin C. Rinard: Randomized accuracy- aware program transformations for efficient approximate computations. POPL 2012: 441-454 • Eric Schulte, Jonathan Dorn, Stephen Harding, Stephanie Forrest, Westley Weimer: Post-compiler software optimization for reducing energy. ASPLOS 2014: 639-652 • Frederick B Cohen: Operating system protection through program evolution. Computers & Security 12, 6 (1993): 565–584. 24

  25. 25

  26. Sosies on line • MDMS • simple blog app • JS on client and server sides MDMS Redis DB • Server side stack RingoJS • JS Rhino • Java JVM • DB OS • environment 26

  27. Sosies on line • Monoculture Internet • multiple instances http request for performance Nginx load balancer • load balancer config 0 config 0 config 0 • all instances are clones config 0 config 0 config 0 27

  28. Sosies on line • Diversified Internet deployment http request • All server instances Nginx load balancer are different config 1 config 2 config 3 • Combine natural and artificial diversity config 4 config 5 config 6 28

  29. 29

  30. Reactions graph R1 R2 (int) (boolean) code code (boolean) (int) • Reactions graph • one node per reaction • there is an edge between n1 and n2 if n2.in_context == n1.in_context ∨ ! n1.out_context 30

  31. 31

  32. Two reactions graph (apache.common) • Statement reactions graph • #edges = 12304 • #nodes = 863 • graph-diameter = 3 • avg path length = 1.466 • avg degree = 14.257 • Expression reactions graph • #edges = 37650 • #nodes = 1953 • graph-diameter = 4 • avg path length = 1.162 • avg degree = 19.278 32

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