to interaction trees
play

to Interaction Trees Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia - PowerPoint PPT Presentation

Specifying, Testing and Verifying a Networked Server From C to Interaction Trees Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia Lennart Beringer, Wolf Honor, William Mansky Benjamin C. Pierce, Steve Zdancewic January 14, 2019 (CPP) 1


  1. Specifying, Testing and Verifying a Networked Server From C to Interaction Trees Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia Lennart Beringer, Wolf Honoré, William Mansky Benjamin C. Pierce, Steve Zdancewic January 14, 2019 (CPP) 1

  2. Verification from RFCs to transistors Application One theorem to verify… OS … and test! More projects at deepspec.org… Hardware 01011... 2

  3. Towards a verified web server HTTP Server OS Hardware 01011... 3

  4. Towards a verified web server Swap Server Today: a simplified server OS Hardware 01011... 4

  5. Main contributions • Verifying a networked C program using VST, which can run in CertiKOS • Specification describes what a client can observe over the network • Testable specification, using QuickChick 5

  6. Swap server specification Cat Bat Client 1 Bat Cat Dog Dog Elk Server Client 2 Cat Elk Client 3 Dog 6

  7. Swap server: in the real world Cat • Messages on different connections can be Dog reordered • Messages can be Clients Bat Server / delayed indefinitely Elk Tester Dog 7

  8. Network refinement Observable behavior Specification by clients Network semantics ∪ I network-refi fines Observable behavior Implementation by clients Network semantics Adaptation of Observational refinement/Linearizability 8

  9. *: concepts defined in the paper Overview: proof architecture Specification* Written in Coq Written in C Server implementation Socket API CertiKOS 9

  10. *: concepts defined in the paper Overview: proof architecture Linear Specification* VST-level network-refines* Socket spec.* validates* Implementation model* CertiKOS-level Socket spec.* refines* assumed by Written in Coq implements Written in C Server implementation Socket API CertiKOS 10

  11. Interaction trees *: concepts defined in the paper A unifying specification language Different spec. styles Different abstraction levels Linear Specification* testing VST-level network-refines* Socket spec.* validates* Implementation model* CertiKOS-level Socket spec.* refines* network-refines* assumed by Written in Coq implements Written in C Server implementation Socket API CertiKOS 11

  12. Interaction trees: example (aka. Free monads) One branch for each possible result ReadBit 0 1 WriteBit 0 ReadBit Shorthand notation for two or more branches tt b2 : bit Ret 1 Ret b2 Type of effects ioE : Inductive ioE : Type -> Type := | ReadBit : ioE bit Result type | WriteBit : bit -> ioE unit . 12

  13. Interaction trees: definition (aka. Free monads) Type of effects (e.g., ioE ) Type of results CoInductive itree ( E : Type -> Type) (R : Type) : Type := | Vis : ∀ Y, E Y -> (Y -> itree E R) -> itree E R | Ret : R -> itree E R | Tau : itree E R -> itree E R . Effect Continuation 13

  14. Interaction trees *: concepts defined in the paper A unifying specification language Different spec. styles Different abstraction levels Linear Specification* testing VST-level network-refines* Socket spec.* validates* Implementation model* CertiKOS-level Socket spec.* refines* network-refines* assumed by Written in Coq implements Written in C Server implementation Socket API CertiKOS 14

  15. The Swap server “linear specification” CoFixpoint loop (open_conns : list conns) (last_msg : bytes) : itree serverE unit := c <- choose open_conns ;; new_msg <- recv_msg c ;; send_msg c last_msg ;; loop open_conns new_msg. Simplified version (see paper) 15

  16. Interaction trees *: concepts defined in the paper Overview: proof architecture Linear Specification* testing VST-level network-refines* Socket spec.* validates* Implementation model* CertiKOS-level Socket spec.* refines* network-refines* assumed by Written in Coq implements Written in C Server implementation Socket API CertiKOS 16

  17. Refinement: from C to ITrees Hoare triple: { pre1 * … * preN } C_program { post1 * … * postN } Separating conjunction Interactions allowed by Assertions on C memory the environment { ITree(impl_model ) * … } C_program { … } Example of a networked C program with its implementation model: { ITree(msg <- Recv c ;; Send c msg ;; Implementation model (itree) t) * … } recv(c, buf, len); . C implementation send(c, buf, len); . { ITree (t) * … } Simplified triples (see paper) 17

  18. The Swap server correctness theorem { ITree(impl_model) } C_prog { … } Theorem correct_server : exists impl_model, refines C_prog impl_model /\ network_refines impl_model linear_spec. ∪ I 19

  19. Complete Summary and next steps connection • Verifying a networked C program using VST, which can run in CertiKOS • The specification describes a client can observe over the network • The specification is testable, using QuickChick and Interaction trees Scale up: Improve proof Swap server -> and testing HTTP Server techniques Add more interfaces: filesystem, encryption… New library https://github.com/DeepSpec/InteractionTrees 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend