application compartmentalization
play

Application compartmentalization Conventional gunzip - PowerPoint PPT Presentation

CHERI A Hybrid Capability-System Architecture for Scalable Software Compartmentalization Robert N.M. Watson * , Jonathan Woodruff * , Peter G. Neumann , Simon W. Moore * , Jonathan Anderson , David Chisnall * , Nirav Dave , Brooks


  1. CHERI A Hybrid Capability-System Architecture for Scalable Software Compartmentalization Robert N.M. Watson * , Jonathan Woodruff * , Peter G. Neumann † , Simon W. Moore * , Jonathan Anderson ‡ , David Chisnall * , Nirav Dave † , Brooks Davis † , Khilan Gudka * , Ben Laurie § , Steven J. Murdoch ¶ , Robert Norton * , Michael Roe * , Stacey Son, and Munraj Vadera * * University of Cambridge, † SRI International, ‡ Memorial University, § Google UK Ltd, ¶ University College London IEEE Symposium on Security and Privacy 18 May 2015 Approved for public release; distribution is unlimited. This research is sponsored by the Defense Advanced Research Projects Agency (DARPA) and the Air Force Research Laboratory (AFRL), under contracts FA8750-10-C-0237 (‘CTSRD’) and FA8750-11-C-0249 (‘MRC2’). The views, opinions, and/or findings contained in this article/presentation are those of the author(s)/presenter(s) and should not be interpreted as representing the official views or policies of the Department of Defense or the U.S. Government.

  2. Application compartmentalization Conventional gunzip Compartmentalized gunzip UNIX process UNIX process Capability-mode process main loop vulnerable decompression main loop vulnerable code decompression code Kernel Kernel Application compartmentalization mitigates vulnerabilities by decomposing applications into isolated compartments delegated limited rights 2

  3. Code-centred compartmentalisation 1 . fetch 2 . fetch 3 . fetch 4 . fetch main loop main loop main loop main loop ftp http ftp http ftp http ftp http auth http get Data-centered compartmentalisation FTP FTP HTTP FTP HTTP auth HTTP GET sandbox sandbox sandbox sandbox sandbox sandbox ssl ssl network sandbox HTTPS SSL ssl ssl sandbox sandbox SSL sandbox 5 . fetch main loop • Many possible compartmentalizations: ftp http • Trade off security, complexity, performance ssl URL-specific sandbox • But the process model is problematic: URL-specific sandbox URL-specific sandbox • Virtual addressing scales poorly due to page tables, Translation Look-aside Buffer (TLB) • Multiple address spaces and Inter-Process Communication (IPC) are hard to program • Quite poor for library compartmentalization due to memory-centered APIs (e.g, zlib) 3

  4. CHERI capability model • ISCA 2014 : Fine-grained, in-address-space memory protection via a capability model • Capabilities replace pointers for data references • Capability registers and tagged memory enforce strong pointer and control-flow integrity, bounds checking • Hybrid model composes naturally with an MMU • ASPLOS 2015 : Compiler support for capabilities • Converge fat-pointer and capability models • C pointers compiled into capabilities with various ABIs • Can we build efficient compartmentalization over CHERI memory protection ? 4

  5. Virtual memory vs. capabilities Virtual Memory Capabilities Protects Virtual addresses and pages References (pointers) to C code, data structures Hardware MMU, TLB Capability registers, tagged memory Costs TLB, page tables, lookups, Per-pointer overhead, shootdowns context switching Compartment scalability Tens to hundreds Thousands or more Domain crossing IPC Function calls Optimization goals Isolation, full virtualization Memory sharing, frequent domain transitions CHERI hybridizes the models: pick two! 5

  6. Hybrid capability/MMU OSes Virtual address spaces zlib zlib libssl zlib libssl zlib libssl class1 Single address space libssl Legacy application class2 Pure-capability + application capability libraries Capability-based OS with legacy Address-space executive Address-space executive libraries OS kernel Address-space executive CHERI CPU 6

  7. CHERI capabilities 1-bit tag v otype (24bits) permissions (31 bits) s 256-bit capability length (64 bits) offset (64 bits) base (64 bits) • Sealed bit prevents further modification • Object types atomically link code, data capabilities Virtual address • CCall/CReturn instructions provide hardware- space assisted, software-defined domain transitions 7

  8. CheriBSD object capabilities • In-process o bject-capability model • libcheri loads and links classes , instantiates objects $c0 $c1 • Per-thread capability register file $c2 describes its protection domain $c3 $c0 $c1 • Domain transition within threads … via register-file transformation $c2 $c3 • CCall / CReturn exception handlers $c31 unseal capabilities, allow delegation … Thread 1 capability • Trusted stack provides reliable registers $c31 software-defined return, recovery Thread 2 • Many other software-defined models capability possible; e.g., asynchronous closures registers Virtual address 8 space

  9. Object-capability call/return • Initial registers after execve() grant ambient authority Ambient object CCall CReturn • Synchronous function-like call eases application/library Compartmentalized object adaptation CCall CReturn • CCall/CReturn ABI clears Compartmentalized object unused registers to prevent CCall CReturn leakage Ambient object • Only authorized system classes can make system calls System System- call call return Kernel • Constant overhead to function-call cost 9

  10. CHERI hardware/software prototypes Implementation on FPGA • Bluespec FPGA prototype • 64-bit MIPS + CHERI ISA • Pipelined, L1/L2 caches, MMU • Synthesizes at ~100MHz • Capability-aware software • CheriBSD OS • CHERI clang/LLVM compiler • Adapted applications • Open-source release 10

  11. 11

  12. Application implications Pros Cons • Single address-space • Still have to reason about the programming model security properties • Referential integrity matches • Shared memory is more subtle programmer model than copy semantics • Modest work to insert • Capability overhead in data protection-domain boundaries cache is real and measurable • Objects permit mutual distrust • ABI subtleties between MIPS and CHERI compiled code • Constant (low) overhead relative to function calls even • Lower overhead raises further with large memory flows cache side-channel concerns 12

  13. Conclusions • Hybrid object-capability model over memory capabilities • Software-defined, fine-grained, in-address-space compartmentalization • Cleanly extends the MMU-based process model • Targets C-language userspace TCBs • Non-IPC model supports library compartmentalization • Orders of magnitude more efficient compartmentalization that conventional designs • Open-source reference implementation, ISA specification: http://www.cheri-cpu.org/ 13

Recommend


More recommend