Hyperkernel: Push-Button Verification of an OS Kernel
Luke Nelson, Helgi Sigurbjarnarson, Kaiyuan Zhang, Dylan Johnson, James Bornholt, Emina Torlak, and Xi Wang
Hyperkernel: Push-Button Verification of an OS Kernel Luke Nelson, - - PowerPoint PPT Presentation
Hyperkernel: Push-Button Verification of an OS Kernel Luke Nelson, Helgi Sigurbjarnarson , Kaiyuan Zhang, Dylan Johnson, James Bornholt, Emina Torlak, and Xi Wang The OS Kernel is a critical component Essential for application correctness and
Luke Nelson, Helgi Sigurbjarnarson, Kaiyuan Zhang, Dylan Johnson, James Bornholt, Emina Torlak, and Xi Wang
Proof effort: 11 person years
Xv6
require writing loop invariants
reason about
Hyperkernel
identity mapping for the kernel
representation (IR)
Xv6
require writing loop invariants
reason about
Hyperkernel
identity mapping for the kernel
representation (IR)
Xv6
require writing loop invariants
reason about
Hyperkernel
use identity mapping for kernel
representation (IR)
Xv6
require writing loop invariants
reason about
Hyperkernel
use identity mapping for kernel
representation (IR)
Xv6
require writing loop invariants
reason about
Hyperkernel
use identity mapping for kernel
representation (IR)
Syscall Implementation
Syscall Implementation State Machine Specification pre new
Syscall Implementation State Machine Specification pre new
Syscall Implementation State Machine Specification pre new
Syscall Implementation State Machine Specification pre new
Syscall Implementation State Machine Specification pre new
Syscall Implementation State Machine Specification Verifier LLVM pre new
Syscall Implementation State Machine Specification Verifier Bug Counterexample
LLVM pre new
Syscall Implementation Verifier Bug Counterexample
Declarative Specification
P
LLVM State Machine Specification pre new
Syscall Implementation State Machine Specification Verifier Bug Counterexample
Declarative Specification
P
LLVM pre new
Syscall Implementation Verifier Counterexample
LLVM State Machine Specification pre new
Bug Declarative Specification
P
Cross-cutting properties:
Syscall Implementation Verifier Counterexample
LLVM State Machine Specification pre new
Bug
Cross-cutting properties:
For any virtual address in a process p, if the virtual address maps to a page the page must be exclusively owned by p.
Declarative Specification
P
Syscall Implementation Verifier Counterexample
LLVM State Machine Specification pre new
Bug
Cross-cutting properties:
For any virtual address in a process p, if the virtual address maps to a page the page must be exclusively owned by p.
Declarative Specification
P
Syscall Implementation State Machine Specification Verifier Bug Counterexample
Declarative Specification
P
LLVM pre new
Syscall Implementation State Machine Specification Verifier LLVM Bug Counterexample
Declarative Specification
P
OK Kernel Image pre new
User space virtual address space
brk
void *sbrk(intptr_t increment)
increments the programs data space by increment bytes
User space virtual address space
brk
void *sbrk(intptr_t increment)
increment
User space virtual address space
brk
void *sbrk(intptr_t increment) increments the programs data space by increment bytes
Goal: Redesign sbrk(); ensuring process isolation.
User space virtual address space
brk
void *sbrk(intptr_t increment) increments the programs data space by increment bytes
void *sbrk(intptr_t increment)
void *sbrk(intptr_t increment)
void *sbrk(intptr_t increment)
page table root
entry
4K page
void *sbrk(intptr_t increment) void *sbrk_one_page()
page table root
entry
4K page
page table root
entry
4K page
void *sbrk_one_page()
PML4 table
entry
4K page page directory page table
entry
page directory
entry
page table
entry
void *sbrk_one_page()
PML4 table
entry
4K page page directory page table
entry
page directory
entry
page table
entry
alloc_pdpt(…) alloc_pd(…) alloc_pt(…) alloc_frame(…) void *sbrk_one_page()
PML4 table
entry
4K page page directory page table
entry
page directory
entry
page table
entry
alloc_pdpt(…) alloc_pd(…) alloc_pt(…) alloc_frame(…) void *sbrk_one_page()
int alloc_pdpt(int pml4, size_t index) int alloc_pd(int pdpt, size_t index) int alloc_pt(int pd, size_t index) int alloc_frame(int pt, size_t index)
Search for free page
alloc page#
alloc, page# success/fail
int alloc_pdpt(int pml4, size_t index, int free_pn) int alloc_pd(int pdpt, size_t index, int free_pn) int alloc_pt(int pd, size_t index, int free_pn) int alloc_frame(int pt, size_t index, int free_pn)
For any virtual address in a process p, if the virtual address maps to a page the page must be exclusively owned by p.