View the Slides
Total Page:16
File Type:pdf, Size:1020Kb
RedLeaf: Isolation and Communication in a Safe Operating System Vikram Narayanan1, Tianjiao Huang1, David Detweiler1, Dan Appel1, Zhaofeng Li1, Gerd Zellweger2, Anton Burtsev1 OSDI ’20 1University of California, Irvine 2VMware Research History of Isolation Cedar Ka�eOS Multics Pilot Scomp SPIN J-Kernel Mondrian VINO Singularity 1973 1980 1983 1995 1996 1999 2002 2005 Year • Isolation of kernel subsystems • Final report of Multics (1976) • Scomp (1983) • Systems remained monolithic • Isolation was expensive 1 Isolation mechanisms • Hardware Isolation • Segmentation (46 cycles)1 • Page table isolation (797 cycles)2 • VMFUNC (396 cycles)3 • Memory protection keys (20-26 cycles)4 • Language based isolation • Compare drivers written (DPDK-style) in a safe high-level language (C, Rust, Go, C#, etc.)5 • Managed runtime and Garbage collection (20-50% overhead on a device-driver workload) 1L4 Microkernel: Jochen Liedtke 2https://sel4.systems/About/Performance/ 3Lightweight Kernel Isolation with Virtualization and VM Functions, VEE 2020 4Hodor: Intra-process isolation for high-throughput data plane libraries 5The Case for Writing Network Drivers in High-Level Programming Languages, ANCS 2019 2 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. A 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. A Vector 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. A B Vector 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. B Vector 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. Vector 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Rust Traditional Safe languages vs Rust Java, C# etc. Garbage Vector collection? 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust A Java, C# etc. Garbage Vector collection? 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust A Java, C# etc. Vector Garbage Vector collection? 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust A B Java, C# etc. Vector Garbage Vector collection? 3 • Linear types • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust B Java, C# etc. Vector Garbage Vector collection? 3 • Enforces type and memory safety • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust B Java, C# etc. Vector • Linear types Garbage Vector collection? 3 • Statically checked at compile time • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust B Java, C# etc. Vector • Linear types • Enforces type and memory Garbage Vector safety collection? 3 • Safety without runtime garbage collection overhead Traditional Safe languages vs Rust Rust B Java, C# etc. Vector • Linear types • Enforces type and memory Garbage Vector safety collection? • Statically checked at compile time 3 Traditional Safe languages vs Rust Rust B Java, C# etc. Vector • Linear types • Enforces type and memory Garbage Vector safety collection? • Statically checked at compile time • Safety without runtime garbage collection overhead 3 Language-based isolation - Rust • Mostly use Rust as a drop-in replacement for C • Numerous possbilities • Fault Isolation • Transparent device-driver recovery • Safe Kernel extensions • Fine-grained capability-based access control etc. 4 Fault isolation in Language-based systems Domain Foo Domain Bar X X fn bar() { do_foo(&obj1, &obj2); fn foo(obj1: &Object1, obj2: &Object2) { } do_work(obj1); do_work(obj2); } • e.g., SPIN (using Modula-3 pointers) 5 Fault isolation in Language-based systems Domain Foo Domain Bar fn bar() { do_foo(&obj1, &obj2); fn foo(obj1: &Object1, obj2: &Object2) { } do_work(obj1); do_work(obj2); } • e.g., SPIN (using Modula-3 pointers) 5 Fault isolation in Language-based systems Domain Foo Domain Bar fn bar() { do_foo(&obj1, &obj2); fn foo(obj1: &Object1, obj2: &Object2) { } do_work(obj1); do_work(obj2); } • e.g., SPIN (using Modula-3 pointers) 5 Fault isolation in Language-based systems Domain Foo Domain Bar fn bar() { do_foo(&obj1, &obj2); fn foo(obj1: &Object1, obj2: &Object2) { } do_work(obj1);X do_work(obj2); } • e.g., SPIN (using Modula-3 pointers) 5 Fault isolation in Language-based systems Domain Foo Domain Bar fn bar() { do_foo(&obj1, &obj2); fn foo(obj1: &Object1, obj2: &Object2) { } do_work(obj1);X do_work(obj2); } • e.g., SPIN (using Modula-3 pointers) 5 Language-based isolation: Deep copy Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1:Object1, obj2:Object2) { call_other(obj1, obj2); } } • e.g., J-Kernel, KaffeOS 6 Language-based isolation: Deep copy Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1:Object1, obj2:Object2) { call_other(obj1, obj2); } } • e.g., J-Kernel, KaffeOS 6 Language-based isolation: Deep copy Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1:Object1, obj2:Object2) { call_other(obj1, obj2); } } • e.g., J-Kernel, KaffeOS 6 Language-based isolation: Deep copy Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1:Object1, obj2:Object2) { call_other(obj1,X obj2); } } • e.g., J-Kernel, KaffeOS 6 Language-based isolation: Capabilities Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } • e.g., J-Kernel 7 Language-based isolation: Capabilities Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } • e.g., J-Kernel 7 Language-based isolation: Capabilities Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } • e.g., J-Kernel 7 Language-based isolation: Capabilities Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } • e.g., J-Kernel 7 Language-based isolation: Capabilities Domain Foo Domain Bar fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1,X &obj2); } • e.g., J-Kernel 7 Language-based isolation: Capabilities Domain Foo Domain Bar X X fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1,X &obj2); } • e.g., J-Kernel 7 • Single ownership model • Static analysis and verification tools (Sing#) • Reusing the moved object return an error • zero-copy Language-based isolation: Singularity Shared Heap fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools Domain Foo Domain Bar • Statically enforced ownership discipline 8 • Static analysis and verification tools (Sing#) • Reusing the moved object return an error • zero-copy Language-based isolation: Singularity Shared Heap fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools Domain Foo Domain Bar • Statically enforced ownership discipline • Single ownership model 8 • Static analysis and verification tools (Sing#) • Reusing the moved object return an error • zero-copy Language-based isolation: Singularity Shared Heap fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools Domain Foo Domain Bar • Statically enforced ownership discipline • Single ownership model 8 • Static analysis and verification tools (Sing#) • Reusing the moved object return an error • zero-copy Language-based isolation: Singularity Shared Heap X fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools Domain Foo Domain Bar • Statically enforced ownership discipline • Single ownership model 8 • Reusing the moved object return an error • zero-copy Language-based isolation: Singularity Shared Heap X fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools Domain Foo Domain Bar • Statically enforced ownership discipline • Single ownership model • Static analysis and verification tools (Sing#) 8 Language-based isolation: Singularity Shared Heap X fn bar(....) { do_work(&obj1, &obj2); fn foo(obj1: Object1, obj2: Object2) { } call_other(obj1, &obj2); } Static analysis Verification tools