An Open Framework for Foundational Proof-Carrying Code Xinyu Feng Yale University Joint work with Zhaozhong Ni (Yale, now at MSR), Zhong Shao (Yale) and.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

A Translation from Typed Assembly Language to Certified Assembly Programming Zhong Shao Yale University Joint work with Zhaozhong Ni Paper URL:
Security of Multithreaded Programs by Compilation Tamara Rezk INDES Project, INRIA Sophia Antipolis Mediterranee Joint work with Gilles Barthe, Alejandro.
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks C.J. Bell, Robert Dockins, Aquinas Hobor, Andrew W. Appel, David Walker 1.
Shape Analysis by Graph Decomposition R. Manevich M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine B. Cook MSR Cambridge.
Foundational Certified Code in a Metalogical Framework Karl Crary and Susmit Sarkar Carnegie Mellon University.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
A Rely-Guarantee-Based Simulation for Verifying Concurrent Program Transformations Hongjin Liang, Xinyu Feng & Ming Fu Univ. of Science and Technology.
Computer Architecture CSCE 350
Automated and Modular Refinement Reasoning for Concurrent Programs Collaborators: Chris Hawblitzel (Microsoft) Erez Petrank (Technion) Serdar Tasiran (Koc.
Advanced Development of Certified OS Kernels Zhong Shao Bryan Ford Yale University November Focus Areas: Operating Systems,
Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
VeriML: Revisiting the Foundations of Proof Assistants Zhong Shao Yale University MacQueen Fest May 13, 2012 (Joint work with Antonis Stampoulis)
Fast Paths in Concurrent Programs Wen Xu, Princeton University Sanjeev Kumar, Intel Labs. Kai Li, Princeton University.
Extensible Verification of Untrusted Code Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck May 14, 2004 OSQ Retreat Santa.
Extensible Kernels Edgar Velázquez-Armendáriz September 24 th 2009.
Modular Verification of Concurrent Assembly Code with Dynamic Thread Creation and Termination Xinyu Feng Yale University Joint work with Zhong Shao.
Typed Assembly Languages COS 441, Fall 2004 Frances Spalding Based on slides from Dave Walker and Greg Morrisett.
An Open Framework for Certified System Software Xinyu Feng Yale University.
Certifying Low-Level Programs with Hardware Interrupts and Preemptive Threads Xinyu Feng Toyota Technological Institute at Chicago Joint work with Zhong.
1 A Dependently Typed Assembly Language Hongwei Xi University of Cincinnati and Robert Harper Carnegie Mellon University.
10/19/2007TTI-C PL-Lunch Certified Concurrent Code with Interrupts Xinyu Feng Joint work with Zhong Shao (Yale University) and Yuan Dong (Tsinghua University)
Modular Verification of Assembly Code with Stack-Based Control Abstractions Xinyu Feng Yale University Joint work with Zhong Shao, Alexander Vaynberg,
On the Relationship Between Concurrent Separation Logic and Assume-Guarantee Reasoning Xinyu Feng Yale University Joint work with Rodrigo Ferreira and.
A Type System for Expressive Security Policies David Walker Cornell University.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
Describing Syntax and Semantics
Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat.
1 I/O Management in Representative Operating Systems.
Foundations of Programming Languages – Course Overview Xinyu Feng Acknowledgments: some slides taken or adapted from lecture notes of Stanford CS242
Compositional Verification of Termination-Preserving Refinement of Concurrent Programs Hongjin Liang Univ. of Science and Technology of China (USTC) Joint.
Modular Machine Code Verification Zhaozhong Ni Advisor: Zhong Shao Committee: Zhong Shao, Paul Hudak Carsten Schürmann, David Walker Department of Computer.
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
Aquinas Hobor and Cristian Gherghina (National University of Singapore) TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Low-Level Program Verification. Components of a Certifying Framework certified code (machine code + proof) specifications: program safety/security/correctness.
Introduction to Our Research on Certifying Compiler Zhaopeng Li (In Chinese: 李兆鹏 ) Certifying Compiler Group USTC-Yale Joint.
Concurrency Verification. Why concurrency verification Concurrent programs show in many systems –Multi-task support in OS kernels –Handling interrupts.
Report on Project CComp Zhaopeng Li Joint work with Prof. Yiyun Chen, Zhong Zhuang, Simin Yang, Dawei Fan, Zhenting Zhang Software Security Lab., USTC,
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Characterizing Progress Properties of Concurrent Objects via Contextual Refinements Hongjin Liang Univ. of Science and Technology of China (USTC) Joint.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
A Certifying Compiler and Pointer Logic Zhaopeng Li Software Security Lab. Department of Computer Science and Technology, University of Science and Technology.
Advanced Development of Certified OS Kernels DARPA CRASH Site Visit PIs: Zhong Shao & Bryan Ford (Yale University) October 5th, Friday, 2012, Room 307.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
Certifying Intermediate Programming Zhaopeng Li
Real Time Programming Language. Intro A programming language represents the nexus of design and structure. But misuse of the programming language can.
Secure Compiler Seminar 4/11 Visions toward a Secure Compiler Toshihiro YOSHINO (D1, Yonezawa Lab.)
Combining Garbage Collection and Safe Manual Memory Management Michael Hicks University of Maryland, College Park Joint work with Greg Morrisett - Harvard,
11th Nov 2004PLDI Region Inference for an Object-Oriented Language Wei Ngan Chin 1,2 Joint work with Florin Craciun 1, Shengchao Qin 1,2, Martin.
Safe to the Last Instruction: Automated Verification of a Type-Safe Operating System Jean Yang MIT CSAIL Chris Hawblitzel Microsoft Research.
Program Logic for Concurrency Refinement Verification Xinyu Feng University of Science and Technology of China Joint work with Hongjin Liang (USTC) and.
What’s Ahead for Embedded Software? (Wed) Gilsoo Kim
1 Lecture 6: Assembly Programs Today’s topics:  Large constants  The compilation process  A full example  Intro to the MARS simulator.
Ichiro Hasuo University of Tokyo Kohei Suenaga JSPS Research Fellow (PD) Kyoto University Programming with Infinitesimals A WHILE-Language for Hybrid System.
Embedded Real-Time Systems
Mostly-Automated Verification of Low-Level Programs in Computational Separation Logic Adam Chlipala Harvard University PLDI 2011.
An Operational Approach to Relaxed Memory Models
A Practical Verification Framework for Preemptive OS Kernels
Low-Level Program Verification
Joint work with Yong Li, Xinyu Feng, Zhong Shao and Yu Zhang
Hongjin Liang, Xinyu Feng & Ming Fu
Stateful Manifest Contracts
Foundations of Programming Languages – Course Overview
Progress of Concurrent Objects with Partial Methods
Foundations of Programming Languages – Course Overview
Separation Logic and Concurrency Verification
Computer Architecture
Presentation transcript:

An Open Framework for Foundational Proof-Carrying Code Xinyu Feng Yale University Joint work with Zhaozhong Ni (Yale, now at MSR), Zhong Shao (Yale) and Yu Guo (USTC)

Motivation How to build fully certified software systems? Source-level codeLibraries and runtime + References with weak upd. Dynamic mem. alloc. Functions, exceptions, … Concurrency I/O Garbage collectors malloc() (strong update) Stacks, code pointers Context switching & Scheduler Device drivers

Motivation All concurrency verification assumes built-in concurrency Assume-Guarantee (A-G) reasoning Concurrent Separation logic (CSL) … Context switching, scheduler Too low-level to be certified in these logics [Yu&Shao, ICFP ’ 04] Threads & schedulers have never been modularly certified!

Motivation Certify all code in a single type system/program logic? Hard to combine all features weak vs. strong update, functions/exceptions vs. goto ’ s, threads vs. thread contexts May not be modular Very complex, hard to use Don ’ t know how to design such a logic Certify modules using the most appropriate logic! Modules do not use all the features at the same time It is simpler to use specialized logic for each module

An Open Framework Certify different modules using different verification systems!

Challenges Extensibility and openness not designed for certain specific interoperations But can we just use MLFs, e.g. Coq? Expressiveness type safety, concurrency properties, partial correctness, … A general and uniform model of control flow Allow functions certified in different systems to call each other the key for modularity: separate verification & proof reuse Principled interoperation with clear meta-property properties of the whole system composed of modules Not readily supported in Coq!

Our contributions OCAP: an open framework Embedding of different systems TAL, non-CPS Hoare-logic, A-G reasoning, … Open & Extensible Modularity with first-class code pointers [Ni&Shao POPL ’ 06] Soundness Type safety, & preservation of invariants in foreign systems Applications TAL + memory allocation libs. Threads + Scheduler The first time to modularly certify both sides …

Outline OCAP Framework Certifying Threads & Schedulers

OCAP Rules LnLn … OCAP : Overview OCAP Soundness Mechanized Meta-Logic (CiC) Modeling of the machine TCB Sound L1L1 ( ) L1 ( ) Ln Sound Mechanized Meta-Logic (CiC) Modeling of the machine … C1C1 CnCn

The Machine I1I1 f1:f1: I2I2 f2:f2: I3I3 f3:f3: … (code heap) C 0 r1r1 12… r2r2 r3r3 …rnrn (data heap) H (register file) R (state) S addu … lw … sw … … j f (instr. seq.) I (program) P::=(C,S,pc) ::=(H,R) ::={f  I} * pc

The OCAP Logic : Overview Hoare-style program logic for assembly CPS-style reasoning Assign a precondition to each basic block Similar to TAL [Morrisett et al. POPL ’ 98]

The OCAP Logic : Overview I1I1 f1:f1: I2I2 f2:f2: I3I3 f3:f3: … (code heap) C 0 r1r1 12… r2r2 r3r3 …rnrn (data heap) H (register file) R (state) S addu … lw … sw … … j f (instr. seq.) I (program) P::=(C,S,pc) ::=(H,R) ::={f  I} * pc a1a1 a2a2 a3a3 (spec)  ::= {f  a} * a

OCAP: Code pointers codeptr(f,a)   (f) = a (Spec)  ::= {f  a} *  a codeptr Not well-founded! Support of first-class code pointers:

OCAP: Code Pointers A generic specification: (CdSpec)  ::= … (Assert) a  Spec  State  Prop (Spec)  ::= {f   } * (  ) ,S. … No interoperation between multiple systems…  a codeptr a   codeptr  ()()

OCAP: Foreign Languages (LangTy) L ::= CiC Terms  Type (CodeSpec)  ::= CiC Terms  L Inductive TalType : Type := T_int : TalType T_pair: TalType -> TalType-> TalType … Inductive Tal2Type : Type := T2_int : TalType T2_pair: TalType -> TalType-> TalType … L ::= TalType | Tal2Type | …  1 ::= T_int | T_pair  1  1 | …  TalType  2 ::= T2_int | T2_pair  2  2 | …  Tal2Type

OCAP: Specifications (OCdSpec)  ::=   L.( L  Assert )* L (Spec)  ::= {(f 1,  1 ), … (f n,  n )} (Assert) a  Spec  State  Prop (Interp) ( ) L  L  Assert (LangTy) L ::= CiC Terms  Type (CodeSpec)  ::= CiC Terms  L Not well-founded:  ( ) L a

OCAP: Specifications (OCdSpec)  ::= (Spec)  ::= {(f 1,  1 ), … (f n,  n )} (Assert) a  Spec  State  Prop (Interp) ( ) L  L  Assert (LangTy) L ::= CiC Terms  Type (CodeSpec)  ::= CiC Terms  L (LangID)  ::= n  nat (LangDict) D ::= {  1 ,…,  n  }  LangID  (  L. L  Assert)  ( ) L a  

Selected OCAP Rules D 1  D 2 ;  1  2 ┝ C 1  C 2 :  1 ’  2 ’ D 1 ;  1 ┝ C 1 :  1 ’ (link) D 2 ;  2 ┝ C 2 :  2 ’ … D ┝ {a}jr r ,S.a  S .(codeptr(S.R(r),  )  a’)  S (jr) a’ = [[[  ]]] D codeptr(f,  )  ,S.  (f)=  [[[  ]]] D  ,S.  ( ) L. ( D (  )= )  ( (  ) L  S)  =

Outline OCAP Framework Certifying Threads & Schedulers

Threads and Scheduler Thread code C 1,…,C n Certified following CCAP [Yu&Shao, ICFP ’ 04] Assume-Guarantee reasoning Thread modularity Do not know about thread queue SCAP CCAP + Scheduler C S Certified in SCAP [Feng et al. PLDI’06] as sequential code Manages thread queue TQ Do not touch H

Scheduler in SCAP yield: pick one word (pc i ) from TQ swap pc i and r 31 jr r 31 H1H1 pc 1 pc n … TQ r 31 r0r0 H1H1 pc 1 pc n … TQ r 31 r0r0 … jal yield ct: … Thread code: ct

Scheduler in SCAP yield: (p s, g s ) pick one word (pc i ) from TQ swap pc i and r 31 jr r 31 gsgs g s  (  r  {r 1,…,r 30 }.[r]=[r]’)   Q, Q ’.  p’.  Q  {[r31]} = Q ’  {[r31]’} WFTQ( Q )*p’ WFTQ( Q ’ )*p’ H1H1 pc 1 pc n … TQ r 31 r0r0 H1H1 pc 1 pc n … TQ r 31 r0r0 ct p s   Q.WFTQ( Q ) * True

Embedding SCAP ( (p,g) ) D scap  … jr $ra g p … D Soundness:  scap ┝ scap C:  ’ scap   (  scap ) D scap D  D scap,  ┝ C:  ’  ’  (  ’ scap ) D scap D scap  {  scap  }

Threads: Assume-Guarantee S p1p1 p2p2 S’S’ Spec. for threads: (p, A, G) p: State  Prop p’1p’1 p 2 ? A, G: State  State  Prop Stability of p: p i S  A i S S ’  p i S ’ G1G1  A 2 A 1, G 1 A 2, G 2

CCAP embedding  ccap ┝ ccap C i :  ’ ccap D all  {  ccap ,  scap  } D all ;  c  y ┝ C i :  ’ c  y  {yield  }  c  (  ccap ) ccap  ’ c  (  ’ ccap ) ccap ( (p,A,G) ) ccap  ,S. …

Certify the code  ccap ┝ ccap C i :  ’ ccap  scap ┝ scap C s :  ’ scap D all  {  ccap ,  scap  } D all ;  y ┝ C s :  ’ y D all ;  c  y ┝ C i :  ’ c SCAP CCAP the “link” rule D all ;  c  y ┝ C i  C s :  ’ c   ’ y

Summary It is simpler and natural to certify different modules using different logics OCAP: framework for interoperation Embedding TAL: type system SCAP: non-cps logic for assembly CCAP: Assume-guarantee reasoning Interoperation TAL + newpair Threads + Scheduler TAL + GC (ongoing work by Lin, McCreight, et al.)

Future work Explore the applicability of OCAP Interoperation of different languages Currently just for assembly language But logics are at different levels (TAL, CCAP, … ) May support C + inlined assembly

Thank you!