Lectures on Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 3 (of 3) June 21-22, 2003 University of Oregon 2004 Summer School on Software.

Slides:



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

Certified Typechecking in Foundational Certified Code Systems Susmit Sarkar Carnegie Mellon University.
Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Web:
Foundational Certified Code in a Metalogical Framework Karl Crary and Susmit Sarkar Carnegie Mellon University.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 20: Total Correctness; Proof-
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
March 4, 2005Susmit Sarkar 1 A Cost-Effective Foundational Certified Code System Susmit Sarkar Thesis Proposal.
Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design.
Types, Proofs, and Safe Mobile Code The unusual effectiveness of logic in programming language research Peter Lee Carnegie Mellon University January 22,
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
Lectures on Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 2 (of 3) June 21-22, 2003 University of Oregon 2004 Summer School on Software.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
An Introduction to Proof-Carrying Code David Walker Princeton University (slides kindly donated by George Necula; modified by David Walker)
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Code-Carrying Proofs Aytekin Vargun Rensselaer Polytechnic Institute.
An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
Type Checking.
Extensible Verification of Untrusted Code Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck May 14, 2004 OSQ Retreat Santa.
Inline Assembly Section 1: Recitation 7. In the early days of computing, most programs were written in assembly code. –Unmanageable because No type checking,
Typed Assembly Languages COS 441, Fall 2004 Frances Spalding Based on slides from Dave Walker and Greg Morrisett.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Under the Hood of the Open Verifier Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck October 21, 2003 OSQ Group Meeting.
1 A Dependently Typed Assembly Language Hongwei Xi University of Cincinnati and Robert Harper Carnegie Mellon University.
Programmability with Proof-Carrying Code George C. Necula University of California Berkeley Peter Lee Carnegie Mellon University.
Language-Based Security Proof-Carrying Code Greg Morrisett Cornell University Thanks to G.Necula & P.Lee.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
A Type System for Expressive Security Policies David Walker Cornell University.
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
1 Type Type system for a programming language = –set of types AND – rules that specify how a typed program is allowed to behave Why? –to generate better.
Describing Syntax and Semantics
Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat.
4/6/08Prof. Hilfinger CS164 Lecture 291 Code Generation Lecture 29 (based on slides by R. Bodik)
1 The Problem o Fluid software cannot be trusted to behave as advertised unknown origin (must be assumed to be malicious) known origin (can be erroneous.
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
Language Evaluation Criteria
Dr. José M. Reyes Álamo 1.  The 80x86 memory addressing modes provide flexible access to memory, allowing you to easily access ◦ Variables ◦ Arrays ◦
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Proof-Carrying Code & Proof-Carrying Authentication Stuart Pickard CSCI 297 June 2, 2005.
Languages and the Machine Chapter 5 CS221. Topics The Compilation Process The Assembly Process Linking and Loading Macros We will skip –Case Study: Extensions.
Mobility, Security, and Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 3 July 12, 2001 VC Generation and Proof Representation Lipari.
Mobility, Security, and Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 2 July 11, 2001 Overview of PCC and Safety Policies Lipari School.
Mobility, Security, and Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 3 July 12, 2001 VC Generation and Proof Representation Lipari.
Assembly תרגול 5 תכנות באסמבלי. Assembly vs. Higher level languages There are NO variables’ type definitions.  All kinds of data are stored in the same.
Carnegie Mellon 1 Odds and Ends Intro to x86-64 Memory Layout.
Secure Compiler Seminar 4/11 Visions toward a Secure Compiler Toshihiro YOSHINO (D1, Yonezawa Lab.)
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
Proof-Carrying Code: A Language-Based Security Approach Thao Doan Wei Hu Liqian Luo Jinlin Yang CS851 Malware 11/16/2004.
Mobility, Security, and Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 4 July 13, 2001 LF, Oracle Strings, and Proof Tools Lipari School.
CSE 60641: Operating Systems George C. Necula and Peter Lee, Safe Kernel Extensions Without Run-Time Checking, OSDI ‘96 –SIGOPS Hall of fame citation:
Arrays. Outline 1.(Introduction) Arrays An array is a contiguous block of list of data in memory. Each element of the list must be the same type and use.
Introduction to Computer Systems Class “The Class That Gives CMU Its Zip!” Randal E. Bryant August 30, 2005.
1 Assembly Language: Function Calls Jennifer Rexford.
Overview of Back-end for CComp Zhaopeng Li Software Security Lab. June 8, 2009.
DR. MIGUEL ÁNGEL OROS HERNÁNDEZ 2. Software de bajo nivel.
Mobility, Security, and Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 2 July 11, 2001 Overview of PCC and Safety Policies Lipari School.
IA32 Processors Evolutionary Design
Certified Code Peter Lee Carnegie Mellon University
Chapter 3 Machine-Level Representation of Programs
Machine-Level Programming 2 Control Flow
A Trustworthy Proof Checker
Language-based Security
Chapter 3 Machine-Level Representation of Programs
Machine-Level Programming II: Control Flow
Lecture 4: Instruction Set Design/Pipelining
Presentation transcript:

Lectures on Proof-Carrying Code Peter Lee Carnegie Mellon University Lecture 3 (of 3) June 21-22, 2003 University of Oregon 2004 Summer School on Software Security

Acknowledgments George Necula Frank Pfenning Karl Crary Zhong Shao Bob Harper

Recap Yesterday we formulated a certification problem defined a VCgen  this necessitated the use of (untrusted) loop invariant annotations showed a simple prover briefly discussed LF as a representation language for predicates and proofs

Continuing… Today we continue by describing how to obtain the annotated programs via certifying compilation

An example of certifying compilation public class Bcopy { public static void bcopy(int[] src, int[] dst) { int l = src.length; int i = 0; for(i=0; i<l; i++) { dst[i] = src[i]; }

Proof rules (excerpts) /\: pred -> pred -> pred. \/: pred -> pred -> pred. =>: pred -> pred -> pred. all: (exp -> pred) -> pred. pf: pred -> type. truei: pf true. andi: {P:pred} {Q:pred} pf P -> pf Q -> pf (/\ P Q). andel: {P:pred} {Q:pred} pf (/\ P Q) -> pf P. ander: {P:pred} {Q:pred} pf (/\ P Q) -> pf Q. … 1. Standard syntax and rules for first-order logic. Type of valid proofs, indexed by predicate. Syntax of predicates. Inference rules.

=: exp -> exp -> pred. <>: exp -> exp -> pred. eq_le: {E:exp} {E':exp} pf (csubeq E E') -> pf (csuble E E'). moddist+: {E:exp} {E':exp} {D:exp} pf (= (mod (+ E E') D) (mod (+ (mod E D) E') D)). =sym: {E:exp} {E':exp} pf (= E E') -> pf (= E' E). <>sym: {E:exp} {E':exp} pf (<> E E') -> pf (<> E' E). =tr: {E:exp} {E':exp} {E'':exp} pf (= E E') -> pf (= E' E'') -> pf (= E E''). Proof rules (excerpts) 2. Syntax and rules for arithmetic and equality. “csuble” means  in the x86 machine.

Proof rules for arithmetic Note that we avoid the need for a sophisticated decision procedure for a fragment of integer arithmetic Intuitively, the prover only needs to be as “smart” as the compiler

Arithmetic Note also that the “safety critical” arithmetic (i.e., array-element address computations) generated by typical compilers is simple and highly structured e.g., multiplications only by 2, 4, or 8 Human programmers, on the other hand, may require much more sophisticated theorem proving

Proof rules (excerpts) jint : exp. jfloat : exp. jarray : exp -> exp. jinstof : exp -> exp. of: exp -> exp -> pred. faddf: {E:exp} {E':exp} pf (of E jfloat) -> pf (of E' jfloat) -> pf (of (fadd E E') jfloat). ext: {E:exp} {C:exp} {D:exp} pf (jextends C D) -> pf (of E (jinstof C)) -> pf (of E (jinstof D)). 3. Syntax and rules for the Java type system.

Java typing rules in the TCB It seems unfortunate to have Java types here, since we are proving properties of x86 machine code More to say about this shortly…

Proof rules (excerpts) aidxi: {I:exp} {LEN:exp} {SIZE:exp} pf (below I LEN) -> pf (arridx (add (imul I SIZE) 8) SIZE LEN). wrArray4: {M:exp} {A:exp} {T:exp} {OFF:exp} {E:exp} pf (of A (jarray T)) -> pf (of M mem) -> pf (nonnull A) -> pf (size T 4) -> pf (arridx OFF 4 (sel4 M (add A 4))) -> pf (of E T) -> pf (safewr4 (add A OFF) E). 4. Rules describing the layout of data structures. This “sel4” means the result of reading 4 bytes from heap M at address A+4.

Compiling model rules in the TCB It is even more unfortunate to have rules that are specific to a single compiler here Though it does tend to lead to compact proofs More to say about this shortly…

Proof rules (excerpts) nlt0_0: pf (csubnlt 0 0). nlt1_0: pf (csubnlt 1 0). nlt2_0: pf (csubnlt 2 0). nlt3_0: pf (csubnlt 3 0). nlt4_0: pf (csubnlt 4 0). 5. Quick hacks. Inevitably, “unclean” things are sometimes put into the specification...

How do we know that it is right?

Back to our example public class Bcopy { public static void bcopy(int[] src, int[] dst) { int l = src.length; int i = 0; for(i=0; i<l; i++) { dst[i] = src[i]; }

Unoptimized loop body L11 : movl4(%ebx), %eax cmpl%eax, %edx jaeL24 L17 : cmpl$0, 12(%ebp) movl8(%ebx, %edx, 4), %esi jeL21 L20 : movl12(%ebp), %edi movl4(%edi), %eax cmpl%eax, %edx jaeL24 L23 : movl%esi, 8(%edi, %edx, 4) movl%edi, 12(%ebp) incl%edx L9 : ANN_INV(ANN_DOM_LOOP, %LF_(/\ (of rm mem ) (of loc1 (jarray jint) ))%_LF, RB(EBP,EBX,ECX,ESP,FTOP,LOC4,LOC3)) cmpl%ecx, %edx jlL11 Bounds check on src. Bounds check on dst. Note: L24 raises the ArrayIndex exception.

Stack Slots Each procedure will want to use the stack for local storage. This raises a serious problem because a lot of information is lost by VCGen (such as the value) when data is stored into memory. We avoid this problem by assuming that procedures use up to 256 words of stack as registers.

Unoptimized code is easy As we saw previously in the sample program Dynamic, in the absence of optimizations, proving the safety of array accesses is relatively easy Indeed, in this case it is reasonable for VCgen to verify the safety of the array accesses

Optimized target code ANN_LOCALS(_bcopy__6arrays5BcopyAIAI, 3).text.align 4.globl _bcopy__6arrays5BcopyAIAI _bcopy__6arrays5BcopyAIAI: cmpl$0, 4(%esp) jeL6 movl4(%esp), %ebx movl4(%ebx), %ecx testl%ecx, %ecx jgL22 ret L22: xorl%edx, %edx cmpl$0, 8(%esp) jeL6 movl8(%esp), %eax movl4(%eax), %esi L7: ANN_LOOP(INV = { (csubneq ebx 0), (csubneq eax 0), (csubb edx ecx), (of rm mem)}, MODREG = (EDI,EDX,EFLAGS,FFLAGS,RM)) cmpl%esi, %edx jaeL13 movl8(%ebx, %edx, 4), %edi movl%edi, 8(%eax, %edx, 4) incl%edx cmpl%ecx, %edx jlL7 ret L13: call__Jv_ThrowBadArrayIndex ANN_UNREACHABLE nop L6: call__Jv_ThrowNullPointer ANN_UNREACHABLE nop

Optimized target code ANN_LOCALS(_bcopy__6arrays5BcopyAIAI, 3).text.align 4.globl _bcopy__6arrays5BcopyAIAI _bcopy__6arrays5BcopyAIAI: cmpl$0, 4(%esp) jeL6 movl4(%esp), %ebx movl4(%ebx), %ecx testl%ecx, %ecx jgL22 ret L22: xorl%edx, %edx cmpl$0, 8(%esp) jeL6 movl8(%esp), %eax movl4(%eax), %esi L7: ANN_LOOP(INV = { (csubneq ebx 0), (csubneq eax 0), (csubb edx ecx), (of rm mem)}, MODREG = (EDI,EDX,EFLAGS,FFLAGS,RM)) cmpl%esi, %edx jaeL13 movl8(%ebx, %edx, 4), %edi movl%edi, 8(%eax, %edx, 4) incl%edx cmpl%ecx, %edx jlL7 ret L13: call__Jv_ThrowBadArrayIndex ANN_UNREACHABLE nop L6: call__Jv_ThrowNullPointer ANN_UNREACHABLE nop VCGen requires annotations in order to simplify the process.

Optimized loop body L7: ANN_LOOP(INV = { (csubneq ebx 0), (csubneq eax 0), (csubb edx ecx), (of rm mem)}, MODREG = (EDI,EDX,EFLAGS,FFLAGS,RM)) cmpl%esi, %edx jaeL13 movl8(%ebx, %edx, 4), %edi movl%edi, 8(%eax, %edx, 4) incl%edx cmpl%ecx, %edx Essential facts about live variables, used by the compiler to eliminate bounds- checks in the loop body.

Loop invariants One can see that the compiler “proves” facts such as r  0 r < r’ (unsigned) and a small number of others The compiler deposits facts about the live variables in the loop

Symbolic evaluation In contrast to the previous lecture, VCgen is actually performed via a forward scan This slightly simplifies the handling of branches

The VCGen Process (1) _bcopy__6arrays5BcopyAIAI: cmpl $0, src je L6 movl src, %ebx movl 4(%ebx), %ecx testl %ecx, %ecx jg L22 ret L22: xorl %edx, %edx cmpl $0, dst je L6 movl dst, %eax movl 4(%eax), %esi L7: ANN_LOOP(INV = … A0 = (type src_1 (jarray jint)) A1 = (type dst_1 (jarray jint)) A2 = (type rm_1 mem) A3 = (csubneq src_1 0) ebx := src_1 ecx := (sel4 rm_1 (add src_1 4)) A4 = (csubgt (sel4 rm_1 (add src_1 4)) 0) edx := 0 A5 = (csubneq dst_1 0) eax := dst_1 esi := (sel4 rm_1 (add dst_1 4))

The VCGen Process (2) L7: ANN_LOOP(INV = { (csubneq ebx 0), (csubneq eax 0), (csubb edx ecx), (of rm mem)}, MODREG = (EDI, EDX, EFLAGS,FFLAGS,RM)) cmpl %esi, %edx jae L13 movl 8(%ebx,%edx,4), %edi movl %edi, 8(%eax,%edx,4) … A3 A5 A6 = (csubb 0 (sel4 rm_1 (add src_1 4))) edi := edi_1 edx := edx_1 rm := rm_2 A7 = (csubb edx_1 (sel4 rm_2 (add dst_1 4)) !!Verify!! (saferd4 (add src_1 (add (imul edx_1 4) 8)))

The Checker (1) The checker is asked to verify that (saferd4 (add src_1 (add (imul edx_1 4) 8))) under assumptions A0 = (type src_1 (jarray jint)) A1 = (type dst_1 (jarray jint)) A2 = (type rm_1 mem) A3 = (csubneq src_1 0) A4 = (csubgt (sel4 rm_1 (add src_1 4)) 0) A5 = (csubneq dst_1 0) A6 = (csubb 0 (sel4 rm_1 (add src_1 4))) A7 = (csubb edx_1 (sel4 rm_2 (add dst_1 4)) The checker looks in the PCC for a proof of this VC.

The Checker (2) In addition to the assumptions, the proof may use axioms and proof rules defined by the host, such as szint : pf (size jint 4) rdArray4: {M:exp} {A:exp} {T:exp} {OFF:exp} pf (type A (jarray T)) -> pf (type M mem) -> pf (nonnull A) -> pf (size T 4) -> pf (arridx OFF 4 (sel4 M (add A 4))) -> pf (saferd4 (add A OFF)).

Checker (3) A proof for (saferd4 (add src_1 (add (imul edx_1 4) 8))) in the Java specification looks like this (excerpt): (rdArray4 A0 A2 (sub0chk A3) szint (aidxi 4 (below1 A7))) This proof can be easily validated via LF type checking.

Example: Proof excerpt (LF representation) ANN_PROOF(_6arrays6Bcopy1_MbcopyAIAI, %LF_(andi (impi [H_1 : pf (of _p22 (jarray jint))] (andi (impi [H_2 : pf (of _p23 (jarray jint))] (andi (impi [H_3 : pf (of _p21 mem)] (andi (impi [H_4 : pf (ceq (sub _p23 0))] truei) (andi (impi [H_5 : pf (cneq (sub _p23 0))] (andi (rd4 (arrLen H_2 (nullcsubne H_5)) szint) (andi (nullcsubne H_5) (andi H_3 (andi H_1 (andi (impi [H_10 : pf (nonnull _p23)] (andi (impi [H_11 : pf (of _p64 mem)] (andi (impi [H_12 : pf (of _p65 (jarray jint))] (andi (impi [H_13 : pf (cnlt (sub _p49 (sel4 _p21 (add _p23 4))))] (andi H_11 truei)) (andi (impi [H_15 : pf (clt (sub _p49 (sel4 _p21 (add _p23 4))))] (andi (rd4 (arrLen H_2 H_10) szint) (andi (impi [H_17 : pf (cnb (sub _p49 (sel4 _p64 (add _p23 4))))] truei) (andi (impi [H_18 : pf (cb (sub _p49 (sel4 _p64 (add _p23 4))))] (andi (rd4 (arrElem H_2 H_11 H_10 szint (ultcsubb H_18)) szint) (andi (impi [H_20 : pf (ceq (sub _p65 0))] truei) (andi (impi [H_21 : pf (cneq (sub _p65 0))] (andi (rd4 (arrLen H_12 (nullcsubne H_21)) szint) (andi (impi [H_23 : pf (cnb (sub _p49 (sel4 _p64 (add _p65 4))))] truei) (andi (impi [H_24 : pf (cb (sub _p49 (sel4 _p64 (add _p65 4))))] (andi (wr4 (arrElem H_12 H_11 (nullcsubne H_21) szint (ultcsubb H_24)) szint (jintany (sel4 _p64 (add _p23 (add (mul _p49 4) 8))))) (andi H_10 (andi (ofamem 1) (andi H_12 truei))))) truei)))) truei))) truei)) truei)))))) truei))) truei)) truei)%_LF)

Improvements

Implementation, in reality Certifying Prover CPU Code Proof Checker VCgen+ ann’s logic

VCgen+ in SpecialJ Core VCGen (12,300 Loc) Symbolic evaluation Register file management Control-flow support (jump, bcond, call, loop handling) Stack-frame management Generic obj. file support x86 (3300 Loc) decoding calling convention special-register handling (FTOP) ARM (1100 Loc) DEC Alpha (1200 Loc) M68k (2500 Loc) COFF (700 Loc) parsing relocation ELF (600 Loc) … MS PE (700 Loc) … Java (3800 Loc).class metadata parsing and checking exception handling annot. parsing and processing Indirect call (270 Loc) Indirect jump (350 Loc) Total: (x86+Java) = 20,000 Loc C code!

The reality of scaling up In SpecialJ, the proofs and annotations are OK, but the VCgen+ is complex, nontrivial C program machine-specific compiler-specific source-language specific safety-policy specific

A systems design principle Separate policy from mechanism One possible approach: devise some kind of universal enforcement mechanism

Typical elements of a system Untrusted Elements Safety is not compromised if these fail. Examples:  Certifying compilers and provers Trusted Elements To ensure safety, these must be right. Examples:  Verifier (type checker, VCgen, proof checker)  Runtime library  Hardware

The trouble with trust Security: A trusted element might be wrong. It’s not clear how much we can do about this.  We can minimize our contribution, but must still trust the operating system.  Windows has more bugs than any certified code system.

The trouble with trust, cont’d Extensibility: Everyone is stuck with the trusted elements.  They cannot be changed by developers.  If a trusted element is unsuitable to a developer, too bad.

Achieving extensibility Main aim: Anyone should be able to target our system Want to support multiple developers, languages, applications. But: No single type or proof system is suitable for every purpose. (Not yet anyway!) Thus: Don’t trust the type/proof system.

Foundational Certified Code In “Foundational” CC, we trust only: 1.A safety policy  Given in terms of the machine architecture. 2.A proof system  For showing compliance with the safety policy. 3.The non-verifier components (runtime library, hardware, etc.) Thus, anyone can target FCC, provided they can construct the required proof.

Foundational PCC We can eliminate VCGen by using a global invariant on states, Inv(S) Then, the proof must show: Inv(S 0 ) S:State. Inv(S) ! Inv(Step(S)) S:State. Inv(S) ! SP(S) In “Foundational PCC”, by Appel and Felty, we trust only the safety policy and the proofchecker, not the VCgen

Other “foundational” work Hamid, Shao, et al. [’02] define the global invariant to be a syntactic well-formedness condition on machine states Crary, et al. [’03] apply similar ideas in the development of TALT Bernard and Lee [’02] use temporal logic specifications as a basis for a foundational PCC system

What is the right safety policy? Whatever the host’s administrator wants it to be! But in practice the question is not always easy to answer…

What is the right safety policy? Some possibilities: Programs must be semantically equivalent to the source program [Pnueli, Rinard, …] Well-typed in a target language with a sound type system [Morrisett, Crary, …] Meets a logical specification (perhaps given in a Hoare logic) [Necula, Lee, …]

Safety in SpecialJ The compiled output of SpecialJ is designed to link with the Java Virtual Machine JVM Stack ADT PCC binary Is it “safe” for this binary to “spoof” stacks? AWT native

Proof rules (excerpts) jint : exp. jfloat : exp. jarray : exp -> exp. jinstof : exp -> exp. of: exp -> exp -> pred. faddf: {E:exp} {E':exp} pf (of E jfloat) -> pf (of E' jfloat) -> pf (of (fadd E E') jfloat). ext: {E:exp} {C:exp} {D:exp} pf (jextends C D) -> pf (of E (jinstof C)) -> pf (of E (jinstof D)). 3. Syntax and rules for the Java type system.

Flexibility in safety policies Memory safety seems to be adequate for many applications But even this much is tricky to specify Writing an LF signature + VCgen, or else rules for a type system, only “indirectly” specifies the safety policy

A language for safety policies Linear-time 1 st -order temporal logic [Manna/Pnueli 80] identify time with CPU clock An attractive policy notation concise: □ (pc < 1000) well-understood semantics can express variety of security policies  including type safety

Temporal logic PCC [Bernard & Lee 02] Encode safety policy (i.e., transition relation for safe execution) formally in temporal logic (following [Pnueli 77]) Prove directly that the program satisfies the safety policy Encode the PCC certificate as a logic program from the combination of safety policy and proof

TL-PCC Certificate is encoded as a logic program (in LF) that, when executed, generates a proof The certificate extracts its own VCs Certificate specializes the VCgen, logic, and annotations to the given program The fact that the certificate does its job correctly can be validated syntactically

Engineering tradeoffs The certificates in foundational systems prove “more”, and hence there is likely to be greater overhead

Engineering tradeoffs in TL-PCC Explicit security policies, easier to trust, change, and maintain No VC generator, much less C code No built-in flow analysis But: Proof checking is much slower

Proof checking time Current prototype in naïve in several ways, and should improve Also represents one end of the spectrum. Is there a “sweet spot”? Necula/Lee 96 Bernard/Lee 02

A current question Since we use SpecialJ for our experiments, the certificates provide only type safety But, in principle, can now enforce properties in temporal-logic How to generate the certificates?

Conclusions PCC shows promise as a practical code certification technology Several significant engineering hurdles remain, however Lots of interesting future research directions

Thank you!