SlideShare a Scribd company logo
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Dealing with constraints in symbolic execution
Bernhard Mallinger
Programming Languages Seminar SS13
TU Wien
June 11th, 2013
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Outline
1 Constraints in Symbolic Execution
2 Optimisations
Constraint independence
Solution caching
Incremental solving
3 Heuristic Approach
Motivation
CORAL
4 Conclusion
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Outline
1 Constraints in Symbolic Execution
2 Optimisations
Constraint independence
Solution caching
Incremental solving
3 Heuristic Approach
Motivation
CORAL
4 Conclusion
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Constraints in Symbolic Execution
Constraints on variables are collected by analysing code:
1 i f (preproc) {
2 i f (extensive_preproc) {
3 // extensive preprocessing
4 }
5 }
extensive preprocessing-block is reached iff
PC ∧ preproc ∧ extensive_preproc is satisfiable
⇒ Unreachability test
⇒ Test case generator
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solvers
Depending on code, different kinds solvers are efficient
Linear arithmetic
Complex functions
General, unstructured constraints
. . .
Tremendous speedup in recent years (SAT)
Especially continuous functions still not solvable
Constraint solving dominates runtime
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Outline
1 Constraints in Symbolic Execution
2 Optimisations
Constraint independence
Solution caching
Incremental solving
3 Heuristic Approach
Motivation
CORAL
4 Conclusion
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Constraint independence
Constraint independence
In the path condition, all constraints are combined
⇒ but not all related
Separate logically independent groups
1 i f (preproc) {
2 // do preproc
3 }
4 // algo
5 i f (postproc) {
6 // do postproc
7 }
PC ∧ preproc ∧ postproc
PC ∧ preproc ∧ ¬postproc
PC ∧ ¬preproc ∧ postproc
PC ∧ ¬preproc ∧ ¬postproc
Variables related if appear in same constraint
⇒ Reachability problem
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Constraint independence
Constraint independence
In the path condition, all constraints are combined
⇒ but not all related
Separate logically independent groups
1 i f (preproc) {
2 // do preproc
3 }
4 // algo
5 i f (postproc) {
6 // do postproc
7 }
PC ∧ preproc ∧ postproc
PC ∧ preproc ∧ ¬postproc
PC ∧ ¬preproc ∧ postproc
PC ∧ ¬preproc ∧ ¬postproc
Variables related if appear in same constraint
⇒ Reachability problem
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Constraint independence
Constraint independence
In the path condition, all constraints are combined
⇒ but not all related
Separate logically independent groups
1 i f (preproc) {
2 // do preproc
3 }
4 // algo
5 i f (postproc) {
6 // do postproc
7 }
PC ∧ preproc ∧ postproc
PC ∧ preproc ∧ ¬postproc
PC ∧ ¬preproc ∧ postproc
PC ∧ ¬preproc ∧ ¬postproc
Variables related if appear in same constraint
⇒ Reachability problem
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solution caching
Solution caching
Multiple queries contain same independent groups of
constraints ⇒ simply cache results
More elaborate: exploit repetitions in path conditions:
1 i f (preproc) {
2 i f (extensive_preproc) {
3 // do extensive preprocessing
4 }
5 }
PC ∧ preproc
PC ∧ preproc ∧ extensive_preproc
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solution caching
Solution caching
Constraint Solution
C1 = {preproc} S1 = {preproc → 1}
C2 = {preproc, ext_preproc} S2 = {preproc → 1,
ext_preproc → 1}
C3 = {preproc, ¬preproc} X
C4 = {preproc, ¬preproc, postproc } X
S2 is a solution to C1 due to C1 ⊆ C2
Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4
S2 often is an extension of S1 since C1 ⊆ C2
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solution caching
Solution caching
Constraint Solution
C1 = {preproc} S1 = {preproc → 1}
C2 = {preproc, ext_preproc} S2 = {preproc → 1,
ext_preproc → 1}
C3 = {preproc, ¬preproc} X
C4 = {preproc, ¬preproc, postproc } X
S2 is a solution to C1 due to C1 ⊆ C2
Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4
S2 often is an extension of S1 since C1 ⊆ C2
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solution caching
Solution caching
Constraint Solution
C1 = {preproc} S1 = {preproc → 1}
C2 = {preproc, ext_preproc} S2 = {preproc → 1,
ext_preproc → 1}
C3 = {preproc, ¬preproc} X
C4 = {preproc, ¬preproc, postproc } X
S2 is a solution to C1 due to C1 ⊆ C2
Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4
S2 often is an extension of S1 since C1 ⊆ C2
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Solution caching
Solution caching
Constraint Solution
C1 = {preproc} S1 = {preproc → 1}
C2 = {preproc, ext_preproc} S2 = {preproc → 1,
ext_preproc → 1}
C3 = {preproc, ¬preproc} X
C4 = {preproc, ¬preproc, postproc } X
S2 is a solution to C1 due to C1 ⊆ C2
Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4
S2 often is an extension of S1 since C1 ⊆ C2
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Incremental solving
Incremental solving
In queries generated in symbolic execution, often only the last
predicates differ
1 i f (postproc) {
2 i f (fancy_output) {
3 // print fancy statistics
4 }
5 }
PC ∧ postproc
PC ∧ postproc ∧ fancy_output
Determine set of variables which are dependent of variables in
last predicate, solve them and else reuse old solution
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Incremental solving
Empirical results
Figure: Performance with and without the solution cache and constraint
independence optimisation in KLEE. Source: Cadar et al., 2008
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Outline
1 Constraints in Symbolic Execution
2 Optimisations
Constraint independence
Solution caching
Incremental solving
3 Heuristic Approach
Motivation
CORAL
4 Conclusion
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Motivation
Motivation
Still many unsolvable path conditions
Can’t search exhaustively, so guess smartly, improve guesses
Reasonable way of “thinking”?
Reinterpret decision problem as optimisation problem
Minimise violations
New precondition: Locality in solution space
Works for all domains, given locality
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Motivation
Metaheuristics
Random initial solutions probably contain viable fragments
Optimise given invalid solutions by local search
Combine promising solutions
Steer towards regions of high objective value
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
CORAL
CORAL
xtan(y)
+ z < x ∗ arctan(z) ∧
sin(y) + cos(y) + tan(y) ≥ x − z ∧
arctan(x) + arctan(y) > y
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
CORAL
CORAL
Focus on floating point computation
Solves constraints by particle swarm optimisation (population
based metaheuristic)
Generates initial solutions randomly in range determined by
interval solver
“Solves all constraints that exact solvers manage and more”
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
CORAL
CORAL: Stepwise Adaptive Weighting
Solutions with even minimal constraint violations are still
infeasible
Avoiding local optima is critical
Stepwise Adaptive Weighting (SAW)
Change objective function dynamically during runtime
Reward solutions that satisfy hard-to-solve constraints
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
CORAL
CORAL: Stepwise Adaptive Weighting
Solutions with even minimal constraint violations are still
infeasible
Avoiding local optima is critical
Stepwise Adaptive Weighting (SAW)
Change objective function dynamically during runtime
Reward solutions that satisfy hard-to-solve constraints
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Outline
1 Constraints in Symbolic Execution
2 Optimisations
Constraint independence
Solution caching
Incremental solving
3 Heuristic Approach
Motivation
CORAL
4 Conclusion
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution
Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion
Conclusion
Constraint solving dominates runtime of symbolic execution
Unsolvable constraints severely hinder symbolic execution
Some optimisations:
Constraint independence
Solution caching
Incremental solving
Harder constraints can/have to be solved (meta-)heuristically
Navigate reasonably, not exhaustively through search space
Try to goal-orientedly optimise infeasible solutions
Deal with local optima (e.g. by SAW)
Bernhard Mallinger Programming Languages Seminar SS13 TU Wien
Dealing with constraints in symbolic execution

More Related Content

Similar to Dealing with complex constraints in symbolic execution

P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
AnaNeacsu5
 
Présentation d'un mémoire à la Louvain School of Management
Présentation d'un mémoire à la Louvain School of ManagementPrésentation d'un mémoire à la Louvain School of Management
Présentation d'un mémoire à la Louvain School of Management
Jean Vanderdonckt
 
Solvers and Applications with CP
Solvers and Applications with CPSolvers and Applications with CP
Solvers and Applications with CP
iaudesc
 
Lec11 rate distortion optimization
Lec11 rate distortion optimizationLec11 rate distortion optimization
Lec11 rate distortion optimization
United States Air Force Academy
 
DeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdfDeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdf
Sean Meyn
 
Algorithmic research
Algorithmic researchAlgorithmic research
Algorithmic research
Merlin Florrence
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
Deepshika Reddy
 
AIRO2008_Cherubini
AIRO2008_CherubiniAIRO2008_Cherubini
AIRO2008_Cherubini
Davide Cherubini
 
Project Operation Management
Project Operation Management Project Operation Management
Project Operation Management
MureedAbbas
 
Portfolio Planning
Portfolio PlanningPortfolio Planning
Portfolio Planning
ahmad bassiouny
 
Symbexecsearch
SymbexecsearchSymbexecsearch
Symbexecsearch
Abhik Roychoudhury
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docxSolving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
whitneyleman54422
 
Tape Storage and CRC Protection
Tape Storage and CRC ProtectionTape Storage and CRC Protection
Tape Storage and CRC Protection
Karel Ha
 
ANSSummer2015
ANSSummer2015ANSSummer2015
ANSSummer2015
Mohammad Abdo
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
karishma gupta
 
Development of Multi-Level ROM
Development of Multi-Level ROMDevelopment of Multi-Level ROM
Development of Multi-Level ROM
Mohammad
 
Methods of Manifold Learning for Dimension Reduction of Large Data Sets
Methods of Manifold Learning for Dimension Reduction of Large Data SetsMethods of Manifold Learning for Dimension Reduction of Large Data Sets
Methods of Manifold Learning for Dimension Reduction of Large Data Sets
Ryan B Harvey, CSDP, CSM
 
Derivative Free Optimization and Robust Optimization
Derivative Free Optimization and Robust OptimizationDerivative Free Optimization and Robust Optimization
Derivative Free Optimization and Robust Optimization
SSA KPI
 
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
Mateus S. H. Cruz
 

Similar to Dealing with complex constraints in symbolic execution (20)

P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
 
Présentation d'un mémoire à la Louvain School of Management
Présentation d'un mémoire à la Louvain School of ManagementPrésentation d'un mémoire à la Louvain School of Management
Présentation d'un mémoire à la Louvain School of Management
 
Solvers and Applications with CP
Solvers and Applications with CPSolvers and Applications with CP
Solvers and Applications with CP
 
Lec11 rate distortion optimization
Lec11 rate distortion optimizationLec11 rate distortion optimization
Lec11 rate distortion optimization
 
DeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdfDeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdf
 
Algorithmic research
Algorithmic researchAlgorithmic research
Algorithmic research
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
 
AIRO2008_Cherubini
AIRO2008_CherubiniAIRO2008_Cherubini
AIRO2008_Cherubini
 
Project Operation Management
Project Operation Management Project Operation Management
Project Operation Management
 
Portfolio Planning
Portfolio PlanningPortfolio Planning
Portfolio Planning
 
Symbexecsearch
SymbexecsearchSymbexecsearch
Symbexecsearch
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docxSolving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
 
Tape Storage and CRC Protection
Tape Storage and CRC ProtectionTape Storage and CRC Protection
Tape Storage and CRC Protection
 
ANSSummer2015
ANSSummer2015ANSSummer2015
ANSSummer2015
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
 
Development of Multi-Level ROM
Development of Multi-Level ROMDevelopment of Multi-Level ROM
Development of Multi-Level ROM
 
Methods of Manifold Learning for Dimension Reduction of Large Data Sets
Methods of Manifold Learning for Dimension Reduction of Large Data SetsMethods of Manifold Learning for Dimension Reduction of Large Data Sets
Methods of Manifold Learning for Dimension Reduction of Large Data Sets
 
Derivative Free Optimization and Robust Optimization
Derivative Free Optimization and Robust OptimizationDerivative Free Optimization and Robust Optimization
Derivative Free Optimization and Robust Optimization
 
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
Inverted Index Based Multi-Keyword Public-key Searchable Encryption with Stro...
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 

Dealing with complex constraints in symbolic execution

  • 1. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Dealing with constraints in symbolic execution Bernhard Mallinger Programming Languages Seminar SS13 TU Wien June 11th, 2013 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 2. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Outline 1 Constraints in Symbolic Execution 2 Optimisations Constraint independence Solution caching Incremental solving 3 Heuristic Approach Motivation CORAL 4 Conclusion Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 3. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Outline 1 Constraints in Symbolic Execution 2 Optimisations Constraint independence Solution caching Incremental solving 3 Heuristic Approach Motivation CORAL 4 Conclusion Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 4. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Constraints in Symbolic Execution Constraints on variables are collected by analysing code: 1 i f (preproc) { 2 i f (extensive_preproc) { 3 // extensive preprocessing 4 } 5 } extensive preprocessing-block is reached iff PC ∧ preproc ∧ extensive_preproc is satisfiable ⇒ Unreachability test ⇒ Test case generator Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 5. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solvers Depending on code, different kinds solvers are efficient Linear arithmetic Complex functions General, unstructured constraints . . . Tremendous speedup in recent years (SAT) Especially continuous functions still not solvable Constraint solving dominates runtime Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 6. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Outline 1 Constraints in Symbolic Execution 2 Optimisations Constraint independence Solution caching Incremental solving 3 Heuristic Approach Motivation CORAL 4 Conclusion Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 7. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Constraint independence Constraint independence In the path condition, all constraints are combined ⇒ but not all related Separate logically independent groups 1 i f (preproc) { 2 // do preproc 3 } 4 // algo 5 i f (postproc) { 6 // do postproc 7 } PC ∧ preproc ∧ postproc PC ∧ preproc ∧ ¬postproc PC ∧ ¬preproc ∧ postproc PC ∧ ¬preproc ∧ ¬postproc Variables related if appear in same constraint ⇒ Reachability problem Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 8. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Constraint independence Constraint independence In the path condition, all constraints are combined ⇒ but not all related Separate logically independent groups 1 i f (preproc) { 2 // do preproc 3 } 4 // algo 5 i f (postproc) { 6 // do postproc 7 } PC ∧ preproc ∧ postproc PC ∧ preproc ∧ ¬postproc PC ∧ ¬preproc ∧ postproc PC ∧ ¬preproc ∧ ¬postproc Variables related if appear in same constraint ⇒ Reachability problem Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 9. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Constraint independence Constraint independence In the path condition, all constraints are combined ⇒ but not all related Separate logically independent groups 1 i f (preproc) { 2 // do preproc 3 } 4 // algo 5 i f (postproc) { 6 // do postproc 7 } PC ∧ preproc ∧ postproc PC ∧ preproc ∧ ¬postproc PC ∧ ¬preproc ∧ postproc PC ∧ ¬preproc ∧ ¬postproc Variables related if appear in same constraint ⇒ Reachability problem Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 10. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solution caching Solution caching Multiple queries contain same independent groups of constraints ⇒ simply cache results More elaborate: exploit repetitions in path conditions: 1 i f (preproc) { 2 i f (extensive_preproc) { 3 // do extensive preprocessing 4 } 5 } PC ∧ preproc PC ∧ preproc ∧ extensive_preproc Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 11. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solution caching Solution caching Constraint Solution C1 = {preproc} S1 = {preproc → 1} C2 = {preproc, ext_preproc} S2 = {preproc → 1, ext_preproc → 1} C3 = {preproc, ¬preproc} X C4 = {preproc, ¬preproc, postproc } X S2 is a solution to C1 due to C1 ⊆ C2 Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4 S2 often is an extension of S1 since C1 ⊆ C2 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 12. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solution caching Solution caching Constraint Solution C1 = {preproc} S1 = {preproc → 1} C2 = {preproc, ext_preproc} S2 = {preproc → 1, ext_preproc → 1} C3 = {preproc, ¬preproc} X C4 = {preproc, ¬preproc, postproc } X S2 is a solution to C1 due to C1 ⊆ C2 Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4 S2 often is an extension of S1 since C1 ⊆ C2 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 13. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solution caching Solution caching Constraint Solution C1 = {preproc} S1 = {preproc → 1} C2 = {preproc, ext_preproc} S2 = {preproc → 1, ext_preproc → 1} C3 = {preproc, ¬preproc} X C4 = {preproc, ¬preproc, postproc } X S2 is a solution to C1 due to C1 ⊆ C2 Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4 S2 often is an extension of S1 since C1 ⊆ C2 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 14. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Solution caching Solution caching Constraint Solution C1 = {preproc} S1 = {preproc → 1} C2 = {preproc, ext_preproc} S2 = {preproc → 1, ext_preproc → 1} C3 = {preproc, ¬preproc} X C4 = {preproc, ¬preproc, postproc } X S2 is a solution to C1 due to C1 ⊆ C2 Since C3 is unsatisfiable, so is C4 as C3 ⊆ C4 S2 often is an extension of S1 since C1 ⊆ C2 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 15. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Incremental solving Incremental solving In queries generated in symbolic execution, often only the last predicates differ 1 i f (postproc) { 2 i f (fancy_output) { 3 // print fancy statistics 4 } 5 } PC ∧ postproc PC ∧ postproc ∧ fancy_output Determine set of variables which are dependent of variables in last predicate, solve them and else reuse old solution Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 16. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Incremental solving Empirical results Figure: Performance with and without the solution cache and constraint independence optimisation in KLEE. Source: Cadar et al., 2008 Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 17. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Outline 1 Constraints in Symbolic Execution 2 Optimisations Constraint independence Solution caching Incremental solving 3 Heuristic Approach Motivation CORAL 4 Conclusion Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 18. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Motivation Motivation Still many unsolvable path conditions Can’t search exhaustively, so guess smartly, improve guesses Reasonable way of “thinking”? Reinterpret decision problem as optimisation problem Minimise violations New precondition: Locality in solution space Works for all domains, given locality Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 19. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Motivation Metaheuristics Random initial solutions probably contain viable fragments Optimise given invalid solutions by local search Combine promising solutions Steer towards regions of high objective value Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 20. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion CORAL CORAL xtan(y) + z < x ∗ arctan(z) ∧ sin(y) + cos(y) + tan(y) ≥ x − z ∧ arctan(x) + arctan(y) > y Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 21. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion CORAL CORAL Focus on floating point computation Solves constraints by particle swarm optimisation (population based metaheuristic) Generates initial solutions randomly in range determined by interval solver “Solves all constraints that exact solvers manage and more” Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 22. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion CORAL CORAL: Stepwise Adaptive Weighting Solutions with even minimal constraint violations are still infeasible Avoiding local optima is critical Stepwise Adaptive Weighting (SAW) Change objective function dynamically during runtime Reward solutions that satisfy hard-to-solve constraints Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 23. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion CORAL CORAL: Stepwise Adaptive Weighting Solutions with even minimal constraint violations are still infeasible Avoiding local optima is critical Stepwise Adaptive Weighting (SAW) Change objective function dynamically during runtime Reward solutions that satisfy hard-to-solve constraints Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 24. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Outline 1 Constraints in Symbolic Execution 2 Optimisations Constraint independence Solution caching Incremental solving 3 Heuristic Approach Motivation CORAL 4 Conclusion Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution
  • 25. Constraints in Symbolic Execution Optimisations Heuristic Approach Conclusion Conclusion Constraint solving dominates runtime of symbolic execution Unsolvable constraints severely hinder symbolic execution Some optimisations: Constraint independence Solution caching Incremental solving Harder constraints can/have to be solved (meta-)heuristically Navigate reasonably, not exhaustively through search space Try to goal-orientedly optimise infeasible solutions Deal with local optima (e.g. by SAW) Bernhard Mallinger Programming Languages Seminar SS13 TU Wien Dealing with constraints in symbolic execution