SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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-HardAnimesh Chaturvedi
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdfAnaNeacsu5
 
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 ManagementJean Vanderdonckt
 
Solvers and Applications with CP
Solvers and Applications with CPSolvers and Applications with CP
Solvers and Applications with CPiaudesc
 
DeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdfDeepLearn2022 1. Goals & AlgorithmDesign.pdf
DeepLearn2022 1. Goals & AlgorithmDesign.pdfSean Meyn
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communicationsDeepshika Reddy
 
Project Operation Management
Project Operation Management Project Operation Management
Project Operation Management MureedAbbas
 
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.docxwhitneyleman54422
 
Tape Storage and CRC Protection
Tape Storage and CRC ProtectionTape Storage and CRC Protection
Tape Storage and CRC ProtectionKarel Ha
 
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 ROMMohammad
 
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 SetsRyan 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 OptimizationSSA 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
 

Ähnlich wie 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...
 

Kürzlich hochgeladen

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 

Kürzlich hochgeladen (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

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