SlideShare a Scribd company logo
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 
2
sosie program 
• Given a specification S 
3
sosie program 
4 
• Given a specification S 
• Given a program P 
that conforms to S 
specified 
correct 
behavior 
bugs, vulnerabilities 
expected behavior
sosie program 
5 
• 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
Motivation 
• Explore brittelness vs. 
plasticity of software 
• Large quantities of 
diverse variants 
• Moving target 
• Failure detection 
computation failure diversity 6 
diversity
Software brittleness 
7 
SRSLSLRSRLLSSRRLRL 
G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
Software brittleness hypothesis 
8 
SRSLSLRSRLLSSRRLRL 
G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
Software brittleness hypothesis 
9 
SRSLSLRSRLLSSRRLRL 
SRSLSLSSRLLSSRRLRL 
G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
Software brittleness hypothesis 
10 
SRSLSLRSRLLSSRRLRL 
SRSLSLSSRLLSSRRLRL 
G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
Software brittleness 
11
12
Software plasticity hypothesis 
13
Software plasticity hypothesis 
14 
SRSLSLRSRLLSSRRLRL 
SRSLSLSSRLLSSRRLRL 
Rinard et al. 
ICSE’10, 
FSE’11 
POPL’12, 
PLDI’14 
sosie
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
Research questions 
Do sosies exist? 
Can we automatically synthesize them? 
What are effective transformations? 
16
Sosiefication process 
17 
7UDQVIRUPDWLRQ 
RQILJXUDWLRQ 
RYHUDJHKHFN RSWLRQDO
7UDQVIRUPDWLRQ 
6RVLHKHFN 
3URJUDP3 
9DULDQW3¶ 
6RVLH3¶ 
6SHFLILFDWLRQ 
7HVW6XLWH
3URJUDP 
7UDQVIRUPDWLRQ 
GHJHQHUDWHG 
YDULDQW3¶ 
RPSLODWLRQ 
RN 
,QSXW 
VWHS 
2XWSXW 
VWHS 
VWHS 
PHWULFV
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
Experimental data 
19 
#test 
cases 
#assert 
coverage 
#statement 
compile 
1me 
test 
1me 
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
20 
nb of trial: 298938 
nb of compile: 81394 
nb of sosie: 28805 (10%) 
don’t compile 
don’t pass all test cases 
sosies
Computation diversity 
• Goal: unpredictability of 
execution flow 
• Computation monitoring: 
• method calls diversity 
• variable diversity 
21 
A.foo() 
IndexedCollection.retainAll(Collection) 
AbstractCollectionDecorator.retainAll(Collection) 
AbstractCollectionDecorator.decorated() 
other calls 
original call 
IndexedCollection.reindex() 
... 
sosie call 
other calls
22 
Easymock: 465 sosies 
Dagger: 481 sosies 
Junit: 446 sosies
Conclusion 
• Sosies exist 
• for all programs 
• Sosies can exhibit computation diversity 
• Next steps 
• variability-aware execution 
• is computational diversity unbounded? 
23 
https://github.com/DIVERSIFY-project/sosies-generator 
http://diversify-project.eu/sosiefied-programs/
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
Sosies on line 
• MDMS 
• simple blog app 
• JS on client and server sides 
• Server side stack 
• JS 
• Java 
• DB 
• environment 
26 
MDMS 
RingoJS 
Rhino 
JVM 
Redis DB 
OS
Sosies on line 
• Monoculture 
• multiple instances 
for performance 
• load balancer 
• all instances are 
clones 
27 
Internet 
http request 
Nginx load balancer 
config 0 config 0 config 0 
config 0 config 0 config 0
Sosies on line 
• Diversified 
deployment 
• All server instances 
are different 
• Combine natural 
and artificial 
diversity 
28 
Internet 
http request 
Nginx load balancer 
config 1 config 2 config 3 
config 4 config 5 config 6
29
Reactions graph 
• 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 
R1 
(int) 
code 
(boolean) 
R2 
(boolean) 
code 
(int)

More Related Content

PPTX
Access pattern of tags
PPT
VNUS Workshop Jordan2010
PPTX
Advances In Varicose Vein Treatment
PDF
Artificial software diversity: automatic synthesis of program sosies
PDF
Nurturing the Software Ecosystems of the Future
PDF
Let the CI spot the holes in tested code with the Descartes tool
PDF
Software Analytics - Achievements and Challenges
PDF
Changes and Bugs: Mining and Predicting Development Activities
Access pattern of tags
VNUS Workshop Jordan2010
Advances In Varicose Vein Treatment
Artificial software diversity: automatic synthesis of program sosies
Nurturing the Software Ecosystems of the Future
Let the CI spot the holes in tested code with the Descartes tool
Software Analytics - Achievements and Challenges
Changes and Bugs: Mining and Predicting Development Activities

Similar to Tailored source-code-transformation-synthesize-computationally-diverse-program-variants (20)

PDF
nullcon 2011 - Fuzzing with Complexities
PDF
Revisiting the Notion of Diversity in Software Testing
PDF
Mutation @ Spotify
PPTX
It Does What You Say, Not What You Mean: Lessons From A Decade of Program Repair
PDF
SCAM 2012 Keynote Slides on Cooperative Testing and Analysis by Tao Xie
PPT
New software testing-techniques
DOC
Mohammed Kharma - A flexible framework for quality assurance and testing of s...
PDF
Se research update
PPTX
Testing Technique
PDF
The CI as a partner for test improvement suggestions
PDF
E.M._Poot
PDF
Pldi09 semantics aware trace analysis
PDF
Testing and test case generation by using fuzzy logic and n
PDF
Changes and Bugs: Mining and Predicting Development Activities
PDF
Stamp breizhcamp 2019
PDF
Software testing
PDF
How static analysis supports quality over 50 million lines of C++ code
PDF
Testing untestable code - phpconpl11
PDF
"CERT Secure Coding Standards" by Dr. Mark Sherman
PPT
OCAT: Object Capture based Automated Testing (ISSTA 2010)
nullcon 2011 - Fuzzing with Complexities
Revisiting the Notion of Diversity in Software Testing
Mutation @ Spotify
It Does What You Say, Not What You Mean: Lessons From A Decade of Program Repair
SCAM 2012 Keynote Slides on Cooperative Testing and Analysis by Tao Xie
New software testing-techniques
Mohammed Kharma - A flexible framework for quality assurance and testing of s...
Se research update
Testing Technique
The CI as a partner for test improvement suggestions
E.M._Poot
Pldi09 semantics aware trace analysis
Testing and test case generation by using fuzzy logic and n
Changes and Bugs: Mining and Predicting Development Activities
Stamp breizhcamp 2019
Software testing
How static analysis supports quality over 50 million lines of C++ code
Testing untestable code - phpconpl11
"CERT Secure Coding Standards" by Dr. Mark Sherman
OCAT: Object Capture based Automated Testing (ISSTA 2010)
Ad

More from FoCAS Initiative (20)

PDF
Fundamentals of Collective Adaptive Systems Manifesto
PDF
Final FoCAS Newsletter, Issue Eight, Winter 2016
PDF
Optimal Floor Heating
PDF
Advanced Manufacturing: An Industrial Application for Collective Adaptive Sys...
PDF
FoCAS Newsletter Issue Seven
PDF
Wrangling Complex Systems
PDF
Where Shall We Have Lunch? Problems For A Computer-aided Future
PDF
Sustainability Challenges In A Complex World
PDF
On Manipulating Attractors In Collective Behaviours Of Bio-hybrid Societies W...
PDF
The Liquid Computing Paradigm
PDF
Complexity And The Relationship Between Knowledge And Action
PDF
FoCAS Newsletter Issue Six
PDF
FoCAS Newsletter Issue Five
PDF
Temporal logics for multi-agent systems
PDF
Advanced Systems Engineering
PDF
Search Diverse Models for Proactive Software Diversification
PDF
Modelling Adaptation Policies As Domain-Specific Constraints
PDF
Quantified NTL
PDF
SOCIAL ADAPTATION OF ROBOTS FOR MODULATING SELF-ORGANIZATION IN ANIMAL SOCIETIES
PDF
Scalability Issues of Firefly-Based Self-Synchronization in Collective Adapti...
Fundamentals of Collective Adaptive Systems Manifesto
Final FoCAS Newsletter, Issue Eight, Winter 2016
Optimal Floor Heating
Advanced Manufacturing: An Industrial Application for Collective Adaptive Sys...
FoCAS Newsletter Issue Seven
Wrangling Complex Systems
Where Shall We Have Lunch? Problems For A Computer-aided Future
Sustainability Challenges In A Complex World
On Manipulating Attractors In Collective Behaviours Of Bio-hybrid Societies W...
The Liquid Computing Paradigm
Complexity And The Relationship Between Knowledge And Action
FoCAS Newsletter Issue Six
FoCAS Newsletter Issue Five
Temporal logics for multi-agent systems
Advanced Systems Engineering
Search Diverse Models for Proactive Software Diversification
Modelling Adaptation Policies As Domain-Specific Constraints
Quantified NTL
SOCIAL ADAPTATION OF ROBOTS FOR MODULATING SELF-ORGANIZATION IN ANIMAL SOCIETIES
Scalability Issues of Firefly-Based Self-Synchronization in Collective Adapti...
Ad

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Machine Learning_overview_presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
Per capita expenditure prediction using model stacking based on satellite ima...
Machine Learning_overview_presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectroscopy.pptx food analysis technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative analysis of optical character recognition models for extracting...
Dropbox Q2 2025 Financial Results & Investor Presentation
Assigned Numbers - 2025 - Bluetooth® Document
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4

Tailored source-code-transformation-synthesize-computationally-diverse-program-variants

  • 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 2
  • 3. sosie program • Given a specification S 3
  • 4. sosie program 4 • Given a specification S • Given a program P that conforms to S specified correct behavior bugs, vulnerabilities expected behavior
  • 5. sosie program 5 • 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
  • 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 7 SRSLSLRSRLLSSRRLRL G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
  • 8. Software brittleness hypothesis 8 SRSLSLRSRLLSSRRLRL G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
  • 9. Software brittleness hypothesis 9 SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
  • 10. Software brittleness hypothesis 10 SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL G. Berry. « A la chasse aux bugs, la maladie du certain » (8 juin 2011)
  • 12. 12
  • 14. Software plasticity hypothesis 14 SRSLSLRSRLLSSRRLRL SRSLSLSSRLLSSRRLRL Rinard et al. ICSE’10, FSE’11 POPL’12, PLDI’14 sosie
  • 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 7UDQVIRUPDWLRQ RQILJXUDWLRQ RYHUDJHKHFN RSWLRQDO
  • 18. 7UDQVIRUPDWLRQ 6RVLHKHFN 3URJUDP3 9DULDQW3¶ 6RVLH3¶ 6SHFLILFDWLRQ 7HVW6XLWH
  • 19. 3URJUDP 7UDQVIRUPDWLRQ GHJHQHUDWHG YDULDQW3¶ RPSLODWLRQ RN ,QSXW VWHS 2XWSXW VWHS VWHS PHWULFV
  • 20. 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
  • 21. Experimental data 19 #test cases #assert coverage #statement compile 1me test 1me 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
  • 22. 20 nb of trial: 298938 nb of compile: 81394 nb of sosie: 28805 (10%) don’t compile don’t pass all test cases sosies
  • 23. Computation diversity • Goal: unpredictability of execution flow • Computation monitoring: • method calls diversity • variable diversity 21 A.foo() IndexedCollection.retainAll(Collection) AbstractCollectionDecorator.retainAll(Collection) AbstractCollectionDecorator.decorated() other calls original call IndexedCollection.reindex() ... sosie call other calls
  • 24. 22 Easymock: 465 sosies Dagger: 481 sosies Junit: 446 sosies
  • 25. Conclusion • Sosies exist • for all programs • Sosies can exhibit computation diversity • Next steps • variability-aware execution • is computational diversity unbounded? 23 https://github.com/DIVERSIFY-project/sosies-generator http://diversify-project.eu/sosiefied-programs/
  • 26. 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
  • 27. 25
  • 28. Sosies on line • MDMS • simple blog app • JS on client and server sides • Server side stack • JS • Java • DB • environment 26 MDMS RingoJS Rhino JVM Redis DB OS
  • 29. Sosies on line • Monoculture • multiple instances for performance • load balancer • all instances are clones 27 Internet http request Nginx load balancer config 0 config 0 config 0 config 0 config 0 config 0
  • 30. Sosies on line • Diversified deployment • All server instances are different • Combine natural and artificial diversity 28 Internet http request Nginx load balancer config 1 config 2 config 3 config 4 config 5 config 6
  • 31. 29
  • 32. Reactions graph • 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 R1 (int) code (boolean) R2 (boolean) code (int)
  • 33. 31
  • 34. 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