+ All Categories
Home > Documents > Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms...

Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms...

Date post: 19-Jul-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
40
Programming and Proving with Distributed Protocols {P } c {Q} ` James R. Wilcox Zach Tatlock Ilya Sergey http://distributedcomponents.net Disel: Distributed Separation Logic
Transcript
Page 1: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Programming and Proving with Distributed Protocols

{P} c {Q}`James R. Wilcox Zach TatlockIlya Sergey

http://distributedcomponents.net

Disel: Distributed Separation Logic

Page 2: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Distributed Systems

Page 3: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Distributed Infrastructure

Page 4: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Distributed Applications

Page 5: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Systems

Page 6: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Infrastructure

-Cert

Veri-

Iron

Wow

Page 7: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Applications

-Cert

Veri-

Iron

Wow

Page 8: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Applications

-Cert

Veri-

Iron

WowChallenging to verify apps in terms of infra. starting from scratch is unacceptable

Indicates deeper problems with composition one node’s client is another’s server!

Page 9: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Applications

-Cert

Veri-

Iron

WowClient reasoning

Invariants

Separation

Challenges

Protocols

rule

rule/Hooks

Solutions

WithInv

Frame

`{P} c {Q}Disel:

Page 10: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Outline

Protocols and running example

Logical mechanismsprogramming with protocolsinvariantsframing and hooks

`{P} c {Q}

Implementation and future work

Page 11: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

SC

21

Page 12: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

Page 13: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Computewhile true: (from, n) <- recv Req send Resp(n, factors(n)) to from

: Server

Traditional specification: messages from server have correct factors

Proved by finding an invariant of the system

Page 14: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Server

Page 15: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Client

Page 16: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Clientsend Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

Start over with clients in system?

In Disel: use protocol to describe client interface

Page 17: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Protocols

Page 18: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Protocols

A protocol is an interface among nodes

Enables compositional verification

Page 19: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute Protocol

State:

Transitions:

Messages:

Sends: precondition and effectReceives: effect

Page 20: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute Protocol

Req

State:

Transitions:

outstanding: Set<Msg>

Messages: Req(n) | Resp(n,s)

Sends: Receives:

Resp

Req Resp

Page 21: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

SC

Req(21)

Effect: none

Send Req(n)Precondition: none

Page 22: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

SC

Req(21)

Effect:

Receive Req(n)add (from, n) to out

{ }(C,21)

Page 23: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

SC

Resp({3,7})

Effect: removes (n,to) from out

Send Resp(n,l)

Requires: l == factors(n)

(n,to) in out

{ }

Page 24: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute

SC

Resp({3,7})

Recv Resp(n,l)

Effect: none

{ }

Page 25: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute Protocol

Req

State:

Transitions:

outstanding: Set<Msg>

Messages: Req(n) | Resp(n,s)

Sends: Receives:

Resp

Req Resp

Page 26: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Outline

Protocols and running example

Logical mechanismsprogramming with protocolsinvariantsframing and hooks

`{P} c {Q}

Implementation and future work

Page 27: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Computewhile true: (from, n) <- recv Req send Resp(n, factors(n)) to from

: Server

Precondition on send requires correct factors

Page 28: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Server

Precondition on send requires correct factors

` send m to ht

t 2

{ }tsent ( )m h,send m to h{Pre }t

while true: (from, n) <- recv Req send Resp(n, factors(n)) to from

Page 29: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Clientsend Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

recv doesn’t ensure correct factors

Page 30: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Clientt 2

` recv t{>} m {recvd( )}m

send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

recv doesn’t ensure correct factors

Page 31: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Protocol Invariants

`{P} c {Q}

`{P ^ I} c {Q ^ I}0

I inductive

Protocol where every state satisfies I

Page 32: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: Clientt 2

Now recv ensures correct factors

` recv t{>} m {recvd( )}m0

send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

Page 33: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Cloud Compute: More Clientssend Req(21) to server1 send Req(35) to server2 (_, ans1) <- recv Resp (_, ans2) <- recv Resp assert ans1 ans2 == {3, 5, 7}[

Same protocol enables verification

Page 34: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Frame rule

`{P} c {Q} R stable

` {P R} c {Q R}⇤ ⇤

Reuse invariants from component protocols

independent protocols

Page 35: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

`{P} c {Q} R stable

` {P R} c {Q R}⇤ ⇤

Frame rule: Hooks

Allows one protocol to restrict another

Page 36: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Outline

Protocols and running example

Logical mechanismsprogramming with protocolsinvariantsframing and hooks

`{P} c {Q}

Implementation and future work

Page 37: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Implementation

Executable via extraction to OCaml

Shallowly embedded in Coqwith full power of functional programming

via trusted shim to implement semantics

Case study: two-phase commitexercises all features of the logic

Page 38: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Related and Future Work

Adding other effectse.g. mutable heap, threads, failure…

Concurrent separation logicsIris, FCSL, CAP, …

Page 39: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Composition: A way to make proofs harder

“In 1997, the unfortunate reality is that engineers rarely specify and reason formally about the systems they build. It seems unlikely that reasoning about the composition of open-system specifications will be a practical concern within the next 15 years.”

Page 40: Disel: Distributed Separation Logic P Q · -Cert Veri-Iron Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition

Verified Distributed Applications

-Cert

Veri-

Iron

WowClient reasoning

Invariants

Separation

Challenges

Protocols

rule

rule/Hooks

Solutions

WithInv

Frame

`{P} c {Q}Disel:


Recommended