Local Reasoning about the Presence of Bugs: Incorrectness Separation - - PowerPoint PPT Presentation

local reasoning about the presence of bugs incorrectness
SMART_READER_LITE
LIVE PREVIEW

Local Reasoning about the Presence of Bugs: Incorrectness Separation - - PowerPoint PPT Presentation

Local Reasoning about the Presence of Bugs: Incorrectness Separation Logic (ISL) Azalea Raad 1,2 Josh Berdine 3 Hoang-Hai Dang 2 Derek Dreyer 2 Peter OHearn 3,4 Jules Villard 3 1 Imperial College London 2 Max Planck Institute for Software


slide-1
SLIDE 1

Local Reasoning about the Presence of Bugs: Incorrectness Separation Logic (ISL)

Azalea Raad1,2 Josh Berdine3 Hoang-Hai Dang2 Derek Dreyer2 Peter O’Hearn3,4 Jules Villard3

azalea@imperial.ac.uk @azalearaad SoundAndComplete.org

1 Imperial College London 2 Max Planck Institute for Software Systems (MPI-SWS) 3 Facebook London 4 University College London

slide-2
SLIDE 2

❖ Lots of work on local reasoning for proving correctness

State of the Art: Correctness

➡ Prove the absence of bugs ➡ Over-approximate reasoning

2

slide-3
SLIDE 3

❖ Lots of work on local reasoning for proving correctness

State of the Art: Correctness

➡ Compositionality

in resources accessed ⇒ spatial locality in code ⇒ reasoning about incomplete components

➡ Prove the absence of bugs ➡ Over-approximate reasoning

2

slide-4
SLIDE 4

❖ Lots of work on local reasoning for proving correctness

State of the Art: Correctness

➡ Compositionality

in resources accessed ⇒ spatial locality in code ⇒ reasoning about incomplete components

➡ Scalability to large teams and codebases ➡ Prove the absence of bugs ➡ Over-approximate reasoning

2

slide-5
SLIDE 5

State of the Art: Bug Catching

❖ Lots of work on bug catching

➡ Prove the presence of bugs ➡ E.g. symbolic model checking, symbolic execution for testing ➡ Under-approximate reasoning

3

slide-6
SLIDE 6

State of the Art: Bug Catching

❖ Lots of work on bug catching

➡ Prove the presence of bugs ➡ E.g. symbolic model checking, symbolic execution for testing ➡ Under-approximate reasoning

❖ Based on global reasoning

3

slide-7
SLIDE 7

State of the Art: Bug Catching

➡ e.g. Infer

❖ Lots of work on bug catching

➡ Prove the presence of bugs ➡ E.g. symbolic model checking, symbolic execution for testing ➡ Under-approximate reasoning

❖ Based on global reasoning ❖ Exceptions using local reasoning

3

slide-8
SLIDE 8

State of the Art: Bug Catching

➡ e.g. Infer

❖ Lots of work on bug catching

➡ Prove the presence of bugs ➡ E.g. symbolic model checking, symbolic execution for testing ➡ Under-approximate reasoning

❖ Based on global reasoning ❖ Exceptions using local reasoning

➡ Using correctness-based compositional analysis

3

slide-9
SLIDE 9

State of the Art: Bug Catching

➡ e.g. Infer

❖ Lots of work on bug catching

➡ Prove the presence of bugs ➡ E.g. symbolic model checking, symbolic execution for testing ➡ Under-approximate reasoning

❖ Based on global reasoning ❖ Exceptions using local reasoning

➡ Using correctness-based compositional analysis

Incorrectness Logic (O’Hearn) Formal Foundations for Bug Catching

3

slide-10
SLIDE 10

4

{p} C {q}

Hoare triples

Incorrectness Logic (IL)

slide-11
SLIDE 11

4

{p} C {q}

For all states s in p if running C on s terminates in s’, then s’ is in q

Hoare triples

Incorrectness Logic (IL)

slide-12
SLIDE 12

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

Incorrectness Logic (IL)

slide-13
SLIDE 13

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

post(C)p q ⊆

Incorrectness Logic (IL)

slide-14
SLIDE 14

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

post(C)p q ⊇

Incorrectness Logic (IL)

slide-15
SLIDE 15

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

[p] C [q]

iff

post(C)p q ⊇

Incorrectness Logic (IL)

slide-16
SLIDE 16

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

[p] C [q]

iff Incorrectness triples

post(C)p q ⊇

Incorrectness Logic (IL)

slide-17
SLIDE 17

4

{p} C {q}

iff

For all states s in p if running C on s terminates in s’, then s’ is in q

post(C)p ⊆ q

Hoare triples

[p] C [q]

iff Incorrectness triples

For all states s in q s can be reached by running C on some s’ in p

post(C)p q ⊇

Incorrectness Logic (IL)

slide-18
SLIDE 18

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

Incorrectness Logic (IL)

slide-19
SLIDE 19

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p

Incorrectness Logic (IL)

slide-20
SLIDE 20

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

Incorrectness Logic (IL)

slide-21
SLIDE 21

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

true positive

Incorrectness Logic (IL)

slide-22
SLIDE 22

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

false positive true positive

Incorrectness Logic (IL)

slide-23
SLIDE 23

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

false positive true positive

[p] C [q]

iff Incorrectness triples

post(C)p q

q under-approximates post(C)p

Incorrectness Logic (IL)

slide-24
SLIDE 24

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

false positive true positive

[p] C [q]

iff Incorrectness triples

post(C)p q

q under-approximates post(C)p

q

post(C)p true positive

Incorrectness Logic (IL)

slide-25
SLIDE 25

5

{p} C {q}

iff

post(C)p ⊆ q

Hoare triples

q over-approximates post(C)p post(C)p

q

false positive true positive

[p] C [q]

iff Incorrectness triples

post(C)p q

q under-approximates post(C)p

q

post(C)p false negative true positive

Incorrectness Logic (IL)

slide-26
SLIDE 26

6

[p] C [𝜁: q] 𝜁: exit condition

  • k: normal execution

er : erroneous execution

Incorrectness Logic (IL)

slide-27
SLIDE 27

6

[p] C [𝜁: q] 𝜁: exit condition

  • k: normal execution

er : erroneous execution

[y=v] x:=y [ok: x=y=v]

Incorrectness Logic (IL)

slide-28
SLIDE 28

6

[p] C [𝜁: q] 𝜁: exit condition

  • k: normal execution

er : erroneous execution

[y=v] x:=y [ok: x=y=v] [p] error( ) [er: p]

Incorrectness Logic (IL)

slide-29
SLIDE 29

7

[p] C [𝜁: q]

iff

post(C, 𝜁)p ⊇ q

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

Equivalent Definition (reachability)

Incorrectness Logic (IL)

slide-30
SLIDE 30

+ Under-approximate analogue of Hoare Logic

Incorrectness Logic: Summary

+ Formal foundation for bug catching

8

slide-31
SLIDE 31

+ Under-approximate analogue of Hoare Logic

Incorrectness Logic: Summary

+ Formal foundation for bug catching

— Global reasoning: non-compositional (as in original Hoare Logic) — Cannot target memory safety bugs (e.g. use-after-free)

8

slide-32
SLIDE 32

+ Under-approximate analogue of Hoare Logic

Incorrectness Logic: Summary

+ Formal foundation for bug catching

— Global reasoning: non-compositional (as in original Hoare Logic) — Cannot target memory safety bugs (e.g. use-after-free)

Our Solution

Incorrectness Separation Logic

8

slide-33
SLIDE 33

Contributions

9

slide-34
SLIDE 34

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching

9

slide-35
SLIDE 35

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

9

slide-36
SLIDE 36

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

❖ Combining IL+SL: not straightforward

➡ invalid frame rule!

9

slide-37
SLIDE 37

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

❖ Combining IL+SL: not straightforward

➡ invalid frame rule!

❖ Fix: a monotonic model for frame preservation

9

slide-38
SLIDE 38

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

❖ Combining IL+SL: not straightforward

➡ invalid frame rule!

❖ Fix: a monotonic model for frame preservation ❖ Recovering the footprint property for completeness

9

slide-39
SLIDE 39

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

❖ Combining IL+SL: not straightforward

➡ invalid frame rule!

❖ Fix: a monotonic model for frame preservation ❖ Recovering the footprint property for completeness ❖ ISL-based analysis

➡ No-false-positives theorem: All bugs found are true bugs

9

slide-40
SLIDE 40

Contributions

❖ Incorrectness Separation Logic (ISL)

➡ IL + SL for compositional bug catching ➡ Under-approximate analogue of SL ➡ Targets memory safety bugs (e.g. use-after-free) ➡ Scalable: inspired by Facebook Pulse

❖ Combining IL+SL: not straightforward

➡ invalid frame rule!

❖ Fix: a monotonic model for frame preservation ❖ Recovering the footprint property for completeness ❖ ISL-based analysis

➡ No-false-positives theorem: All bugs found are true bugs

9

This talk

slide-41
SLIDE 41

10

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

slide-42
SLIDE 42

10

What Is Separation Logic (SL)?

[x]:= 1; [y]:= 2; [z]:= 3;

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

slide-43
SLIDE 43

10

What Is Separation Logic (SL)?

[x]:= 1; [y]:= 2; [z]:= 3;

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

{x = 1 ∧ y = 2 ∧ z = 3} post:

slide-44
SLIDE 44

10

What Is Separation Logic (SL)?

[x]:= 1; [y]:= 2; [z]:= 3;

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

{x = 1 ∧ y = 2 ∧ z = 3} post: {x ≠ y ∧ x ≠ z ∧ y ≠ z} pre:

slide-45
SLIDE 45

10

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x1]:= 1; [x2]:= 2; … [xn]:= n;

{ x1 = 1 ∧ … ∧ xn = n } post: { x1 ≠ x2 ∧ x1 ≠ x3 ∧ … } pre:

slide-46
SLIDE 46

10

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x1]:= 1; [x2]:= 2; … [xn]:= n;

{ x1 = 1 ∧ … ∧ xn = n } post: { x1 ≠ x2 ∧ x1 ≠ x3 ∧ … } pre:

n!/2 conjuncts !

slide-47
SLIDE 47

11

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x]:= 1; [y]:= 2; [z]:= 3;

{ x ↦ 1 ✽ y ↦ 2 ✽ z ↦ 3 } post: { x ↦ - ✽ y ↦ - ✽ z ↦ - } pre:

slide-48
SLIDE 48

11

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x]:= 1; [y]:= 2; [z]:= 3;

{ x ↦ 1 ✽ y ↦ 2 ✽ z ↦ 3 } post: { x ↦ - ✽ y ↦ - ✽ z ↦ - } pre:

‘and separately’

slide-49
SLIDE 49

11

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x]:= 1; [y]:= 2; [z]:= 3;

{ x ↦ 1 ✽ y ↦ 2 ✽ z ↦ 3 } post: { x ↦ - ✽ y ↦ - ✽ z ↦ - } pre:

  • wnership
  • f heap cell at x

‘and separately’

slide-50
SLIDE 50

11

What Is Separation Logic (SL)?

SL : Local & compositional reasoning via ownership & separation ☛ ideal for heap-manipulating programs with aliasing

[x]:= 1; [y]:= 2; [z]:= 3;

{ x ↦ 1 ✽ y ↦ 2 ✽ z ↦ 3 } post: { x ↦ - ✽ y ↦ - ✽ z ↦ - } pre:

  • wnership
  • f heap cell at x

‘and separately’

∀x,v,v’. x ↦ v ✽ x ↦ v’ ⇒ false

slide-51
SLIDE 51

12

The Essence of Separation Logic (SL)

{p✽r} C {q✽r} {p} C {q}

Frame Rule

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

slide-52
SLIDE 52

12

The Essence of Separation Logic (SL)

{p✽r} C {q✽r} {p} C {q}

Frame Rule

{x ↦ -} [x]:= v {x ↦ v}

Local Axioms

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

WRITE

slide-53
SLIDE 53

12

The Essence of Separation Logic (SL)

{p✽r} C {q✽r} {p} C {q}

Frame Rule

{x ↦ -} [x]:= v {x ↦ v}

Local Axioms

{x ↦ v} y:= [x] {x ↦ v ∧ y=v} x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

WRITE READ

slide-54
SLIDE 54

12

The Essence of Separation Logic (SL)

{p✽r} C {q✽r} {p} C {q}

Frame Rule

{x ↦ -} [x]:= v {x ↦ v}

Local Axioms

{x ↦ v} y:= [x] {x ↦ v ∧ y=v} {emp} x:= alloc() {∃l. l ↦ -∧ x=l} x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

WRITE READ ALLOC

slide-55
SLIDE 55

12

The Essence of Separation Logic (SL)

{p✽r} C {q✽r} {p} C {q}

Frame Rule

{x ↦ -} [x]:= v {x ↦ v}

Local Axioms

{x ↦ v} y:= [x] {x ↦ v ∧ y=v} {emp} x:= alloc() {∃l. l ↦ -∧ x=l} {x ↦ -} free(x) { emp } x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

WRITE READ ALLOC FREE

slide-56
SLIDE 56

13

Incorrectness Separation Logic (ISL)

[p] C [𝜁: q]

IL

{p✽r} C {q✽r} {p} C {q}

x ↦ - ✽ x ↦ - ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

SL

slide-57
SLIDE 57

13

Incorrectness Separation Logic (ISL)

[p] C [𝜁: q]

IL

{p✽r} C {q✽r} {p} C {q}

x ↦ - ✽ x ↦ - ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

SL

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

slide-58
SLIDE 58

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

slide-59
SLIDE 59

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null]

slide-60
SLIDE 60

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null]

null-pointer dereference error

slide-61
SLIDE 61

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null] [x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null]

READ

null-pointer dereference error

slide-62
SLIDE 62

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null] [x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null]

READ

[emp] x:= alloc() [ok:∃l. l ↦ v ∧ x=l]

ALLOC

null-pointer dereference error

slide-63
SLIDE 63

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null] [x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null]

READ

[emp] x:= alloc() [ok:∃l. l ↦ v ∧ x=l]

ALLOC

[x ↦ v] free(x) [ok: emp] [x=null] free(x) [er: x=null]

FREE

null-pointer dereference error

slide-64
SLIDE 64

14

ISL: Local Axioms (First Attempt)

[x ↦ v’] [x]:= v [ok: x ↦ v]

WRITE

[x=null] [x]:= v [er: x=null] [x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null]

READ

[emp] x:= alloc() [ok:∃l. l ↦ v ∧ x=l]

ALLOC

[x ↦ v] free(x) [ok: emp] [x=null] free(x) [er: x=null]

FREE

null-pointer dereference error

slide-65
SLIDE 65

15

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

[x ↦ v] free(x) [ok: emp]

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

ISL: Local Axioms (First Attempt)

slide-66
SLIDE 66

15

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

[x ↦ v] free(x) [ok: emp] [x ↦ v✽x ↦ v] free(x) [ok: emp✽x ↦ v]

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

ISL: Local Axioms (First Attempt)

(Frame)

slide-67
SLIDE 67

15

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

[x ↦ v] free(x) [ok: emp] [x ↦ v✽x ↦ v] free(x) [ok: emp✽x ↦ v] [false] free(x) [ok: x ↦ v]

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

ISL: Local Axioms (First Attempt)

(Frame) (Cons)

slide-68
SLIDE 68

15

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

[x ↦ v] free(x) [ok: emp] [x ↦ v✽x ↦ v] free(x) [ok: emp✽x ↦ v] [false] free(x) [ok: x ↦ v]

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

[false] C [𝜁: q] ✗

(unless q ⇒ false)

ISL: Local Axioms (First Attempt)

(Frame) (Cons)

slide-69
SLIDE 69

15

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

[x ↦ v] free(x) [ok: emp] [x ↦ v✽x ↦ v] free(x) [ok: emp✽x ↦ v] [false] free(x) [ok: x ↦ v]

[p✽r] C [𝜁: q✽r] [p] C [𝜁: q]

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v ISL

[false] C [𝜁: q] ✗

(unless q ⇒ false)

ISL: Local Axioms (First Attempt)

(Frame) (Cons)

Solution: Track Deallocated Locations!

slide-70
SLIDE 70

16

Solution: Track Deallocated Locations!

[x ↦ v] free(x) [ok: ] emp

slide-71
SLIDE 71

16

Solution: Track Deallocated Locations!

[x ↦ v] free(x) [ok: ] ↦ x

slide-72
SLIDE 72

16

Solution: Track Deallocated Locations!

x is deallocated

[x ↦ v] free(x) [ok: ] ↦ x

slide-73
SLIDE 73

16

Solution: Track Deallocated Locations!

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v

x is deallocated

[x ↦ v] free(x) [ok: ] ↦ x

slide-74
SLIDE 74

16

Solution: Track Deallocated Locations!

x ↦ v ✽ x ↦ v’ ⇔ false x ↦ v ✽ emp ⇔ x ↦ v x ↦ ✽ x ↦ ⇔ false

x is deallocated

x ↦ v ✽ x ↦ ⇔ false [x ↦ v] free(x) [ok: ] ↦ x

slide-75
SLIDE 75

17

Solution: Track Deallocated Locations!

[x ↦ v] free(x) [ok: x ] ↦

slide-76
SLIDE 76

17

Solution: Track Deallocated Locations!

[x ↦ v] free(x) [ok: x ] ↦ [x ↦ v✽x ↦ v] free(x) [ok: x ✽x ↦ v] ↦

slide-77
SLIDE 77

17

Solution: Track Deallocated Locations!

[x ↦ v] free(x) [ok: x ] ↦ [false] free(x) [ok: false] [x ↦ v✽x ↦ v] free(x) [ok: x ✽x ↦ v] ↦

[p] C [𝜁: false]✔ (vacuous)

[p] C [𝜁: q]

iff

∀ s ∈ q. ∃ s’ ∈ p. (s’,s) ∈ [C]𝜁

slide-78
SLIDE 78

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

slide-79
SLIDE 79

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

[x ] free(x) [er: x ]

↦ ↦

slide-80
SLIDE 80

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

use-after-free error

[x ] free(x) [er: x ]

↦ ↦

slide-81
SLIDE 81

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

use-after-free error

[x ] free(x) [er: x ]

↦ ↦

[x ↦ v’] [x]:= v [ok: x ↦ v] [x=null] [x]:= v [er: x=null] [x ] [x]:= v [er: x ]

↦ ↦

WRITE

slide-82
SLIDE 82

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

use-after-free error

[x ] free(x) [er: x ]

↦ ↦

[x ↦ v’] [x]:= v [ok: x ↦ v] [x=null] [x]:= v [er: x=null] [x ] [x]:= v [er: x ]

↦ ↦

WRITE

[x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null] [x ] y:= [x] [er: x ]

↦ ↦

READ

slide-83
SLIDE 83

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

use-after-free error

[x ] free(x) [er: x ]

↦ ↦

[x ↦ v’] [x]:= v [ok: x ↦ v] [x=null] [x]:= v [er: x=null] [x ] [x]:= v [er: x ]

↦ ↦

WRITE

[x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null] [x ] y:= [x] [er: x ]

↦ ↦

READ

[emp] x:= alloc() [ok:∃l. l ↦ v ∧ x=l ]

ALLOC

slide-84
SLIDE 84

18

ISL: Local Axioms

[x ↦ v] free(x) [ok: x ] [x=null] free(x) [er: x=null]

FREE

use-after-free error

[x ] free(x) [er: x ]

↦ ↦

[x ↦ v’] [x]:= v [ok: x ↦ v] [x=null] [x]:= v [er: x=null] [x ] [x]:= v [er: x ]

↦ ↦

WRITE

[x ↦ v] y:= [x] [ok: x ↦ v∧y=v] [x=null] y:= [x] [er: x=null] [x ] y:= [x] [er: x ]

↦ ↦

READ

[emp] x:= alloc() [ok:∃l. l ↦ v ∧ x=l ]

ALLOC

[y ] x:= alloc() [ok: y ↦ v ∧ x=y ]

slide-85
SLIDE 85

Conclusions

  • Incorrectness Logic (IL)

➡ A rigorous foundation for bug catching ➡ A unifying theory of testing and verification

slide-86
SLIDE 86

Conclusions

  • Incorrectness Logic (IL)

➡ A rigorous foundation for bug catching ➡ A unifying theory of testing and verification

  • Incorrectness Separation Logic (ISL)

➡ Combining IL and SL for compositional bug catching ➡ A monotonic model for frame preservation ➡ Recovering the footprint property for completeness

slide-87
SLIDE 87

Conclusions

  • Incorrectness Logic (IL)

➡ A rigorous foundation for bug catching ➡ A unifying theory of testing and verification

  • Incorrectness Separation Logic (ISL)

➡ Combining IL and SL for compositional bug catching ➡ A monotonic model for frame preservation ➡ Recovering the footprint property for completeness

  • Future work

➡ Concurrent Incorrectness Separation Logic (CISL) Extending ISL with concurrency Tools for deadlock detection, race detection, …

slide-88
SLIDE 88

Conclusions

  • Incorrectness Logic (IL)

➡ A rigorous foundation for bug catching ➡ A unifying theory of testing and verification

  • Incorrectness Separation Logic (ISL)

➡ Combining IL and SL for compositional bug catching ➡ A monotonic model for frame preservation ➡ Recovering the footprint property for completeness

  • Future work

➡ Concurrent Incorrectness Separation Logic (CISL) Extending ISL with concurrency Tools for deadlock detection, race detection, …

azalea@imperial.ac.uk @azalearaad SoundAndComplete.org

Thank You for Listening!

slide-89
SLIDE 89

Incorrectness Separation Logic

Correctness

  • Prove absence of bugs
  • Local reasoning
  • Compositionality

➡ in code (incomplete code) ➡ in resources accessed

Verification

  • A. Raad J. Berdine H-H. Dang D. Dreyer P

. O’Hearn J. Villard July 23rd @ 9:15

slide-90
SLIDE 90

Incorrectness Separation Logic

Correctness

  • Prove absence of bugs
  • Local reasoning
  • Compositionality

➡ in code (incomplete code) ➡ in resources accessed

Bug Catching (incorrectness)

  • Prove presence of bugs
  • Global reasoning

➡ e.g. symbolic model checking

  • Local exceptions: e.g. Infer

➡ Based on correctness

Verification

  • A. Raad J. Berdine H-H. Dang D. Dreyer P

. O’Hearn J. Villard July 23rd @ 9:15

slide-91
SLIDE 91

Incorrectness Separation Logic

Correctness

  • Prove absence of bugs
  • Local reasoning
  • Compositionality

➡ in code (incomplete code) ➡ in resources accessed

Bug Catching (incorrectness)

  • Prove presence of bugs
  • Global reasoning

➡ e.g. symbolic model checking

  • Local exceptions: e.g. Infer

➡ Based on correctness

Incorrectness Separation Logic (ISL) Incorrectness logic: global reasoning for bug catching

+

Separation logic: correctness-based local reasoning

Verification

  • A. Raad J. Berdine H-H. Dang D. Dreyer P

. O’Hearn J. Villard July 23rd @ 9:15

slide-92
SLIDE 92

Incorrectness Separation Logic

Correctness

  • Prove absence of bugs
  • Local reasoning
  • Compositionality

➡ in code (incomplete code) ➡ in resources accessed

Bug Catching (incorrectness)

  • Prove presence of bugs
  • Global reasoning

➡ e.g. symbolic model checking

  • Local exceptions: e.g. Infer

➡ Based on correctness

Incorrectness Separation Logic (ISL) Incorrectness logic: global reasoning for bug catching

+

Separation logic: correctness-based local reasoning Formal foundation for local & compositional bug catching

Verification

  • A. Raad J. Berdine H-H. Dang D. Dreyer P

. O’Hearn J. Villard July 23rd @ 9:15