From Program Verification to Certified Binaries Angelos Manousaridis Michalis A. Papakyriakou Nikolaos S. Papaspyrou National Technical University of Athens School of Electrical and Computer Engineering Software Engineering Laboratory {amanous, mpapakyr, nickie}@softlab.ntua.gr Logic and Theory of Algorithms 4th Conference on Computability in Europe Athens, Greece, June 18, 2008 A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 1 / 19
❖❱❊❘❆▲▲ ❘❆❚■◆●✿ ✲✹ ✭✉♥❛❝❝❡♣t❛❜❧❡ ❢♦r ♣r❡s❡♥t❛t✐♦♥✮ ❘❊❱■❊❲❊❘✬❙ ❈❖◆❋■❉❊◆❈❊✿ ✸ ✭❤✐❣❤✮ ✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✲ ❘❊❱■❊❲ ✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✲ ❚❤✐s s❤♦rt ♣❛♣❡r r❡♣❧❛②s t❤❡ ❞❡❝❛❞❡ ♦❧❞ ✈✐s✐♦♥ ♦❢ ♣r♦♦❢✲❝❛rr②✐♥❣ ❝♦❞❡✱ ❜✉t ❛✐♠✐♥❣ t♦ ✐♥❝r❡❛s❡ t❤❡ ❧❡✈❡❧ ♦❢ ❛♠❜✐t✐♦♥ ❢r♦♠ s✐♠♣❧❡ ♠❡♠♦r② ❛♥❞ ❝♦♥tr♦❧✲❢❧♦✇ ♣r♦♣❡rt✐❡s t♦ ❛r❜✐tr❛r② ♣r♦❣r❛♠ ♣r♦♣❡rt✐❡s✳ ■ ✇❛s ✉♥❛❜❧❡ t♦ s♣♦t ❛♥② r❡s❡❛r❝❤ ❝♦♥tr✐❜✉t✐♦♥s ♦r ♥♦✈❡❧t② ✐♥ t❤❡ ♣❛♣❡r✳ ■♥ s✉♠♠❛r②✱ t❤✐s ✇♦r❦ ✐s ♠✉❝❤ t♦♦ ♣r❡❧✐♠✐♥❛r② ❛♥❞ ✐s ✐♥ t❤❡ ❝✉rr❡♥t st❛t❡ ✉♥❛❝❝❡♣t❛❜❧❡ ❢♦r ♣r❡s❡♥t❛t✐♦♥✳ What is this about? A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 2 / 19
What is this about? ❖❱❊❘❆▲▲ ❘❆❚■◆●✿ ✲✹ ✭✉♥❛❝❝❡♣t❛❜❧❡ ❢♦r ♣r❡s❡♥t❛t✐♦♥✮ ❘❊❱■❊❲❊❘✬❙ ❈❖◆❋■❉❊◆❈❊✿ ✸ ✭❤✐❣❤✮ ✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✲ ❘❊❱■❊❲ ✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✕✲ ❚❤✐s s❤♦rt ♣❛♣❡r r❡♣❧❛②s t❤❡ ❞❡❝❛❞❡ ♦❧❞ ✈✐s✐♦♥ ♦❢ ♣r♦♦❢✲❝❛rr②✐♥❣ ❝♦❞❡✱ ❜✉t ❛✐♠✐♥❣ t♦ ✐♥❝r❡❛s❡ t❤❡ ❧❡✈❡❧ ♦❢ ❛♠❜✐t✐♦♥ ❢r♦♠ s✐♠♣❧❡ ♠❡♠♦r② ❛♥❞ ❝♦♥tr♦❧✲❢❧♦✇ ♣r♦♣❡rt✐❡s t♦ ❛r❜✐tr❛r② ♣r♦❣r❛♠ ♣r♦♣❡rt✐❡s✳ (snip) ■ ✇❛s ✉♥❛❜❧❡ t♦ s♣♦t ❛♥② r❡s❡❛r❝❤ ❝♦♥tr✐❜✉t✐♦♥s ♦r ♥♦✈❡❧t② ✐♥ t❤❡ ♣❛♣❡r✳ (snip) ■♥ s✉♠♠❛r②✱ t❤✐s ✇♦r❦ ✐s ♠✉❝❤ t♦♦ ♣r❡❧✐♠✐♥❛r② ❛♥❞ ✐s ✐♥ t❤❡ ❝✉rr❡♥t st❛t❡ ✉♥❛❝❝❡♣t❛❜❧❡ ❢♦r ♣r❡s❡♥t❛t✐♦♥✳ A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 2 / 19
So, what is this all about? ◮ A position paper, not much of a research paper ◮ Goal? the construction of certified software i.e. that provably satisfies its specifications ◮ Why? the Holy Grail of software engineering! ◮ How? by combining formal verification and proof-carrying code A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 3 / 19
Outline Introduction Program verification Proof-carrying code Motivation A Hybrid System A Motivating Example Proof-preserving Compilation Conclusion A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 4 / 19
Introduction (i) ◮ Program verification ◮ aims at formally proving program correctness ◮ given a formal specification or property ◮ long tradition (4 decades) ◮ several formal logics (e.g. Hoare Logic) ◮ at the source code level A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 5 / 19
Introduction (ii) ◮ Proof-carrying code (PCC) ◮ certified binary: a value together with a proof that the value satisfies a given specification ◮ relatively recent approach ( ∼ 10 years) ◮ essential in modern distributed computer systems ◮ executable code is transferred among devices that do not necessarily trust one another ◮ at a lower level (e.g. machine language) ◮ mainly interested in relatively simple properties: memory safety and control flow A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 6 / 19
Introduction (iii) ◮ Type-theoretic approaches to PCC e.g. Shao et al. , POPL 2002, TOPLAS 2005; Crary and Vanderwaart, ICFP 2002 ◮ arbitrary program properties ◮ embedding of logic “formulae as types” ◮ proof-preserving compilation ◮ makes the proof a part of the code ◮ type (proof) inference is undecidable A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 7 / 19
Motivation Program PCC verification programmer “friendly” high-level proofs end-user safety A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 8 / 19
Motivation Program PCC verification programmer “friendly” high-level proofs end-user safety A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 8 / 19
Motivation Program PCC verification programmer “friendly” high-level proofs end-user safety A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 8 / 19
Motivation Program PCC verification programmer “friendly” high-level proofs end-user safety A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 8 / 19
Motivation Program PCC verification programmer “friendly” high-level proofs end-user safety Can we write programs in a high-level language, provide correctness proofs for them and then compile them to provably correct executable code? A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 8 / 19
A hybrid system A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 9 / 19
✴✴❅ ✴✴❅ ✴✯❅ r❡q✉✐r❡s ❅ ❡♥s✉r❡s ❅✯✴ ✐♥t r♦♦t ✭✐♥t ♥✮ ④ ✐♥t ② ❂ ✵❀ ✴✴❅ ✇❤✐❧❡ ✭✭②✰✶✮✯✭②✰✶✮ ❁❂ ♥✮ ②✰✰❀ r❡t✉r♥ ②❀ ⑥ Integer square root (i) ◮ Given n ∈ N , find the greatest r ∈ N such that r 2 ≤ n A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 10 / 19
✴✴❅ ✴✴❅ ✴✯❅ r❡q✉✐r❡s ❅ ❡♥s✉r❡s ❅✯✴ ✴✴❅ Integer square root (i) ◮ Given n ∈ N , find the greatest r ∈ N such that r 2 ≤ n ✐♥t r♦♦t ✭✐♥t ♥✮ ④ ✐♥t ② ❂ ✵❀ ✇❤✐❧❡ ✭✭②✰✶✮✯✭②✰✶✮ ❁❂ ♥✮ ②✰✰❀ r❡t✉r♥ ②❀ ⑥ A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 10 / 19
✴✯❅ r❡q✉✐r❡s ❅ ❡♥s✉r❡s ❅✯✴ ✴✴❅ Integer square root (i) ◮ Given n ∈ N , find the greatest r ∈ N such that r 2 ≤ n ✴✴❅ predicate leRoot ( int r , int x ) { r ≥ 0 ∧ r 2 ≤ x } ✴✴❅ predicate isRoot ( int r , int x ) { leRoot ( r , x ) ∧ ( r + 1 ) 2 > x } ✐♥t r♦♦t ✭✐♥t ♥✮ ④ ✐♥t ② ❂ ✵❀ ✇❤✐❧❡ ✭✭②✰✶✮✯✭②✰✶✮ ❁❂ ♥✮ ②✰✰❀ r❡t✉r♥ ②❀ ⑥ A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 10 / 19
✴✴❅ Integer square root (i) ◮ Given n ∈ N , find the greatest r ∈ N such that r 2 ≤ n ✴✴❅ predicate leRoot ( int r , int x ) { r ≥ 0 ∧ r 2 ≤ x } ✴✴❅ predicate isRoot ( int r , int x ) { leRoot ( r , x ) ∧ ( r + 1 ) 2 > x } ✴✯❅ r❡q✉✐r❡s n ≥ 0 isRoot ( \ result , n ) ❅ ❡♥s✉r❡s ❅✯✴ ✐♥t r♦♦t ✭✐♥t ♥✮ ④ ✐♥t ② ❂ ✵❀ ✇❤✐❧❡ ✭✭②✰✶✮✯✭②✰✶✮ ❁❂ ♥✮ ②✰✰❀ r❡t✉r♥ ②❀ ⑥ A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 10 / 19
Integer square root (i) ◮ Given n ∈ N , find the greatest r ∈ N such that r 2 ≤ n ✴✴❅ predicate leRoot ( int r , int x ) { r ≥ 0 ∧ r 2 ≤ x } ✴✴❅ predicate isRoot ( int r , int x ) { leRoot ( r , x ) ∧ ( r + 1 ) 2 > x } ✴✯❅ r❡q✉✐r❡s n ≥ 0 isRoot ( \ result , n ) ❅ ❡♥s✉r❡s ❅✯✴ ✐♥t r♦♦t ✭✐♥t ♥✮ ④ ✐♥t ② ❂ ✵❀ ✴✴❅ invariant leRoot ( y , n ) ✇❤✐❧❡ ✭✭②✰✶✮✯✭②✰✶✮ ❁❂ ♥✮ ②✰✰❀ r❡t✉r♥ ②❀ ⑥ A. Manousaridis, M. A. Papakyriakou, N. S. Papaspyrou From Program Verification to Certified Binaries 10 / 19
Recommend
More recommend