verifying the sel4 microkernel
play

Verifying the seL4 Microkernel Formal Proof in Mathematics and - PowerPoint PPT Presentation

Verifying the seL4 Microkernel Formal Proof in Mathematics and Computer Science Lukas Stevens 21st June 2018 Outline 2. Design process of seL4 3. Formal methods of the correctness proof 4. Layers of the correctness proof 5. Conclusion 1 1.


  1. Verifying the seL4 Microkernel Formal Proof in Mathematics and Computer Science Lukas Stevens 21st June 2018

  2. Outline 2. Design process of seL4 3. Formal methods of the correctness proof 4. Layers of the correctness proof 5. Conclusion 1 1. What is a µ -kernel?

  3. What is a µ -kernel?

  4. What is a kernel anyway? • Necessary abstractions for applications • Interaction via system calls • Loaded into protected memory region Bugs are potentially fatal 2

  5. What is a kernel anyway? • Necessary abstractions for applications • Interaction via system calls • Loaded into protected memory region Bugs are potentially fatal 2

  6. What is a kernel anyway? • Necessary abstractions for applications • Interaction via system calls • Loaded into protected memory region Bugs are potentially fatal 2

  7. What is a kernel anyway? • Necessary abstractions for applications • Interaction via system calls • Loaded into protected memory region Bugs are potentially fatal 2

  8. What is a kernel anyway? • Necessary abstractions for applications • Interaction via system calls • Loaded into protected memory region 2 ⇒ Bugs are potentially fatal

  9. Defjnition: Microkernel ing it outside the kernel, i.e. permitting competing implementations, would prevent the implementation of the system’s required functionality. — Jochen Liedtke 3 A concept is tolerated inside the µ -kernel only if mov-

  10. 4 Monolithic kernels and µ -kernels OS based on OS based on Monolithic Kernel Microkernel Applications Applications User Device Drivers Mode UNIX- File Application Device File System IPC Server System Drivers IPC, Virtual Memory, Scheduling Kernel mode etc. Basic IPC, Virtual Memory, Scheduling Hardware Hardware

  11. • Member of the L4 -kernel family • Correctness verifjed with Isabelle • High performance 5 The seL4 µ -kernel

  12. • Correctness verifjed with Isabelle • High performance 5 The seL4 µ -kernel • Member of the L4 µ -kernel family

  13. • Correctness verifjed with Isabelle • High performance 5 The seL4 µ -kernel • Member of the L4 µ -kernel family

  14. • Correctness verifjed with Isabelle • High performance 5 The seL4 µ -kernel • Member of the L4 µ -kernel family

  15. Design process of seL4

  16. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  17. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  18. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  19. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  20. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  21. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  22. Design process for verifjcation Proof Stage 2 Stage 1 Translation Automatic Design Improvement Implementation Implementation Proof Requirements mentation C imple- Specifjcation Abstract Specifjcation Executable Prototype Haskell 6

  23. Formal methods of the correctness proof

  24. Hoare logic P C Q 7 � �� � � �� � � �� � { x = 1 } { x = 2 } x := x + 1

  25. More Hoare logic x and y are even 8 { x = 0 ∧ x = 1 } y := 2 ∗ x { }

  26. More Hoare logic x and y are even 8 { x is even } y := 2 ∗ x { }

  27. More Hoare logic 8 { x is even } y := 2 ∗ x { x and y are even }

  28. Partial correctness of Hoare logic WHILE true DO c 9 { } { }

  29. Data refjnement A concrete system C refjnes an abstract specifjcation A if the behaviour of C is contained in that of A . 10

  30. Data refjnement A concrete system C refjnes an abstract specifjcation A if the behaviour of C is contained in that of A . 10

  31. Data refjnement: Examples • The scheduler selects runnable threads • System calls return non-zero values on error 11

  32. Layers of the correctness proof

  33. Proof structure Executable Specifjcation Abstract Specifjcation C implementation (Semantics) Haskell prototype C implementation Isabelle/HOL Proof Automatic translation 12

  34. Abstract specifjcation The abstract specifjcation is the most high-level layer still fully encapturing the behaviour of the kernel. 13

  35. Scheduler on the abstract level switch_to_thread thread od OR switch_to_idle_thread 14 schedule ≡ do threads ← all_active_tcbs; thread ← select threads;

  36. Executable specifjcation Fill in the details left open by the abstract specifjcation. 15

  37. Haskell implementation of the scheduler tcbSchedDequeue thread accordingly. Check if thread is runnable and act Queue. Try to fjnd runnable thread in thread. Call chooseThread to select next schedule idle thread. priority using chooseThread' or Get runnable thread with highest return True switchToThread thread else do return False if not runnable then do schedule = do runnable <- isRunnable thread chooseThread'' thread = do liftM isJust $ findM chooseThread'' q q <- getQueue prio chooseThread' prio = do when (r == Nothing) $ switchToIdleThread r <- findM chooseThread' (reverse [minBound .. maxBound]) chooseThread = do ... setSchedulerAction ResumeCurrentThread chooseThread ChooseNewThread -> do case action of action <- getSchedulerAction 16

  38. Haskell implementation of the scheduler tcbSchedDequeue thread accordingly. Check if thread is runnable and act Queue. Try to fjnd runnable thread in thread. Call chooseThread to select next schedule idle thread. priority using chooseThread' or Get runnable thread with highest return True switchToThread thread else do return False if not runnable then do schedule = do runnable <- isRunnable thread chooseThread'' thread = do liftM isJust $ findM chooseThread'' q q <- getQueue prio chooseThread' prio = do when (r == Nothing) $ switchToIdleThread r <- findM chooseThread' (reverse [minBound .. maxBound]) chooseThread = do ... setSchedulerAction ResumeCurrentThread chooseThread ChooseNewThread -> do case action of action <- getSchedulerAction 16

  39. Haskell implementation of the scheduler tcbSchedDequeue thread accordingly. Check if thread is runnable and act Queue. Try to fjnd runnable thread in thread. Call chooseThread to select next schedule idle thread. priority using chooseThread' or Get runnable thread with highest return True switchToThread thread else do return False if not runnable then do schedule = do runnable <- isRunnable thread chooseThread'' thread = do liftM isJust $ findM chooseThread'' q q <- getQueue prio chooseThread' prio = do when (r == Nothing) $ switchToIdleThread r <- findM chooseThread' (reverse [minBound .. maxBound]) chooseThread = do ... setSchedulerAction ResumeCurrentThread chooseThread ChooseNewThread -> do case action of action <- getSchedulerAction 16

  40. Haskell implementation of the scheduler tcbSchedDequeue thread accordingly. Check if thread is runnable and act Queue. Try to fjnd runnable thread in thread. Call chooseThread to select next schedule idle thread. priority using chooseThread' or Get runnable thread with highest return True switchToThread thread else do return False if not runnable then do schedule = do runnable <- isRunnable thread chooseThread'' thread = do liftM isJust $ findM chooseThread'' q q <- getQueue prio chooseThread' prio = do when (r == Nothing) $ switchToIdleThread r <- findM chooseThread' (reverse [minBound .. maxBound]) chooseThread = do ... setSchedulerAction ResumeCurrentThread chooseThread ChooseNewThread -> do case action of action <- getSchedulerAction 16

Recommend


More recommend