Software Verification - Computer Science Department at … · 2020. 10. 19. · Software...
Transcript of Software Verification - Computer Science Department at … · 2020. 10. 19. · Software...
![Page 1: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/1.jpg)
Software Verification(preview of COS 510 “Programming Languages”)
Andrew W. Appel
PrincetonUniversity
![Page 2: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/2.jpg)
Formal reasoningabout programs and programming languages
2
FunctionalProgramming
Proving your(functional)
programs correct
![Page 3: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/3.jpg)
ProvingHoare Logic
sound
Formal reasoningabout programs and programming languages
3
intro to
FormalLogic
FunctionalProgramming
Proving your(functional)
programs correct
Provingyour type
system sound
HoareLogic
Proving your(imperative)
programs correct
ImperativeProgramming
Typesystems
Specificationof programming
languages
![Page 4: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/4.jpg)
ProvingHoare Logic
sound
Which of these things do we doBy machine? With pencil+paper?
4
intro to
FormalLogic
FunctionalProgramming
Specificationof programming
languages
Proving your(functional)
programs correct
Provingyour type
system sound
HoareLogic
Proving your(imperative)
programs correct
ImperativeProgramming
Typesystems
![Page 5: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/5.jpg)
ProvingHoare Logic
sound
We can do all of theseBy machine! pencil+paper? Really?
5
intro to
FormalLogic
FunctionalProgramming
Specificationof programming
languages
Proving your(functional)
programs correct
Provingyour type
system sound
HoareLogic
Proving your(imperative)
programs correct
ImperativeProgramming
Typesystems
![Page 6: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/6.jpg)
ProvingHoare Logic
sound
COS 510: Machine-checked, formal reasoningabout programs and programming languages
6
intro to
FormalLogic
FunctionalProgramming
Specificationof programming
languages
Proving your(functional)
programs correct
Provingyour type
system sound
HoareLogic
Proving your(imperative)
programs correct
ImperativeProgramming
Typesystems
![Page 7: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/7.jpg)
EXAMPLE: LENGTH, APP
7
![Page 8: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/8.jpg)
8
![Page 9: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/9.jpg)
9
![Page 10: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/10.jpg)
10
![Page 11: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/11.jpg)
11
![Page 12: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/12.jpg)
12
![Page 13: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/13.jpg)
13
![Page 14: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/14.jpg)
14
![Page 15: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/15.jpg)
15
![Page 16: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/16.jpg)
16
![Page 17: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/17.jpg)
17
![Page 18: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/18.jpg)
18
![Page 19: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/19.jpg)
19
![Page 20: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/20.jpg)
20
![Page 21: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/21.jpg)
21
![Page 22: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/22.jpg)
22
![Page 23: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/23.jpg)
23
![Page 24: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/24.jpg)
24
![Page 25: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/25.jpg)
25
![Page 26: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/26.jpg)
26
![Page 27: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/27.jpg)
27
![Page 28: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/28.jpg)
28
![Page 29: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/29.jpg)
29
![Page 30: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/30.jpg)
Applications of Formal Methods
30
![Page 31: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/31.jpg)
31
Attacking a web server
Web ServerClient PC
for(i=0;p[i];i++)
search[i]=p[i];
URLs
Input in web forms
Crypto keys for SSL
etc.
this is a really long search term that overflows a buffer
![Page 32: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/32.jpg)
32
Attacking a web browser
Web Server
@ badguy.comClient PC
for(i=0;p[i];i++)
gif[i]=p[i];
HTML keywords
Images
Image names
URLs
etc.
www.badguy.com
Earn $$$ Thousands
working at home!
![Page 33: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/33.jpg)
33
Attacking everything in sight
The Internet
@ badguy.comClient device
E-mail client
PDF viewer
Web browser
Operating-system kernel
TCP/IP stack
Any application that ever sees input directly from the outside
![Page 34: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/34.jpg)
34
Solution: implement the outward-facing parts of
software without any bugs!
The Internet
@ badguy.comClient device
E-mail client
PDF viewer
Web browser
Operating-system kernel
TCP/IP stack
Any application that ever sees input directly from the outside
![Page 35: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/35.jpg)
In recent years, great progress in . . .
• Proved-correct optimizing C compiler (France)
• Proved-correct ML compiler (Sweden, Princeton)
• Proved-correct O.S. kernels (Australia, New Haven)
• Proved-correct crypto (Princeton NJ, Cambridge MA)
• Proved-correct distributed systems (Seattle, Israel)
• Proved-correct web server (Philadelphia)
• Proved-correct malloc/free library (Princeton, Hoboken)
35
![Page 36: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/36.jpg)
Automated verification in industry
Amazon
Microsoft
Intel
Galois, HRL, Rockwell, Bedrock, …
36
![Page 37: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/37.jpg)
Recent Princeton JIW / Sr. Thesis
• Katherine Ye ’16 verified crypto security
• Naphat Sanguansin ’16 verified crypto impl’n
• Brian McSwiggen ’18 verified B-trees
• Katja Vassilev ’19 verified dead-var elimination
• John Li ’19 verified uncurrying
• Jake Waksbaum ’20 verified Burrows-Wheeler
• Anvay Grover ’20 verified CPS-conversion
37
![Page 38: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/38.jpg)
38
ACM Conference on Computer and Communications Security 2017
’16 ’16
’81
![Page 39: Software Verification - Computer Science Department at … · 2020. 10. 19. · Software Verification (preview of COS 510 “Programming Languages”) Andrew W. Appel Princeton University](https://reader033.fdocuments.in/reader033/viewer/2022061001/60aff79c76a51d6ce62a143b/html5/thumbnails/39.jpg)
Prerequisites for COS 510 if you’re an undergrad
1. COS 326 Functional Programming
2. Enjoy the proofs in COS 326
3. Get the form signed by Colleen Kenny-McGinley,
room 210 (one-stop shopping, all three signatures):
39