The Open Kernel Environment (opening up all levels of the processing hierarchy in a 'safe' manner) Herbert Bos Bart Samwel Leiden University

Slides:



Advertisements
Similar presentations
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
Advertisements

01/05/2015Leiden Institute of Advanced Computer Science 1 The Open Kernel Environment - spinning Linux - Herbert Bos Bart Samwel
Binary Component Adaptation Ralph Keller and Urs Hölzle Dept. of Computer Science University of California, Santa Barbara 1998.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM B. Bershad, S. Savage, P. Pardyak, E. G. Sirer, D. Becker, M. Fiuczynski, C. Chambers,
Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
CPSC 388 – Compiler Design and Construction
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
G Robert Grimm New York University Extensibility: SPIN and exokernels.
Memory Management 2010.
OS Spring’03 Introduction Operating Systems Spring 2003.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
FFPF: Fairly Fast Packet Filters uspace kspace nspace Vrije Universiteit Amsterdam Herbert Bos Willem de Bruijn Trung Nguyen Mihai Cristea Georgios Portokalidis.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Reference Counters Associate a counter with each heap item Whenever a heap item is created, such as by a new or malloc instruction, initialize the counter.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Efficient Software-Based Fault Isolation—sandboxing Presented by Carl Yao.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
System Calls 1.
Chapter 7: Runtime Environment –Run time memory organization. We need to use memory to store: –code –static data (global variables) –dynamic data objects.
Secure Virtual Architecture John Criswell, Arushi Aggarwal, Andrew Lenharth, Dinakar Dhurjati, and Vikram Adve University of Illinois at Urbana-Champaign.
CSC 501 Lecture 2: Processes. Process Process is a running program a program in execution an “instantiation” of a program Program is a bunch of instructions.
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
© 2004, D. J. Foreman 1 Memory Management. © 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ generates references for function addresses may be.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
PA0 due 60 hours. Lecture 4 Memory Management OSTEP Virtualization CPU: illusion of private CPU RAM: illusion of private memory Concurrency Persistence.
Chapter 4 Memory Management Virtual Memory.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM
RUN-Time Organization Compiler phase— Before writing a code generator, we must decide how to marshal the resources of the target machine (instructions,
Operating Systems Lecture 14 Segments Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software Engineering.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Operating Systems Security
Object-Oriented Programming Chapter Chapter
Processes and Virtual Memory
Full and Para Virtualization
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Efficient software-based fault isolation Robert Wahbe, Steven Lucco, Thomas Anderson & Susan Graham Presented by: Stelian Coros.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Efficient Software-Based Fault Isolation Authors: Robert Wahbe Steven Lucco Thomas E. Anderson Susan L. Graham Presenter: Gregory Netland.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
ISBN Chapter 12 Support for Object-Oriented Programming.
RealTimeSystems Lab Jong-Koo, Lim
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Introduction to Operating Systems Concepts
Introduction to Operating Systems
Processes and threads.
Names and Attributes Names are a key programming language feature
Memory Protection: Kernel and User Address Spaces
COMBINED PAGING AND SEGMENTATION
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Presentation by Omar Abu-Azzah
Memory Management © 2004, D. J. Foreman.
Instructors: Haryadi Gunawi
Memory Protection: Kernel and User Address Spaces
Introduction to Operating Systems
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Pointers C#, pointers can only be declared to hold the memory addresses of value types int i = 5; int *p; p = &i; *p = 10; // changes the value of i to.
Binding Times Binding is an association between two things Examples:
point when a program element is bound to a characteristic or property
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Structure of Processes
Memory Protection: Kernel and User Address Spaces
Presentation transcript:

The Open Kernel Environment (opening up all levels of the processing hierarchy in a 'safe' manner) Herbert Bos Bart Samwel Leiden University H. Bos – Leiden University 1/15/031

What is this about? ● goals: (1) allow 3 rd party programming of lower levels (2) safety enforced by software based isolation ● target: environments with little hardware support for isolating applications – so, no MMU or privileged instructions – example: Linux kernel, network processors ● fully optimised native code / speed ● safety/resource control – CPU, heap, stack, API, etc H. Bos – Leiden University 1/15/03 1

OKE: Open Kernel Environment ● explicit trust management + trusted compiler compiler: restrict code's access to resources depending on privileges code loader accepts code + authentication + credentials if match : load code of specific type type = with specific resource restrictions instantiation of type happens by parameterisation example: type = { MAX_HEAP < 1 MB } example: instantiation = { MAX_HEAP = 100 kB } restrictions CPU, heap, stack (recursion), APIs pointer, private data, access to memory bus (and more) H. Bos – Leiden University 1/15/03 1

OKE Compiler H. Bos – Leiden University 1/15/03 1 object code credentials compilation record OKE Code Loader Network OKE support code Module A Module B Module C credential-based authorisation used for other SCAMPI operations as well compilation record is just another credential credentials are set explicitly and used transparently: scampi_set_authorisation_cred () admission control resources

OKE Credentials: delegated trust management KeyNote-Version: 2 Comment: trivial policy: authorise licensees for operation 'createFlow' Authorizer: "POLICY" Licensees: "rsa-base64:MEgCQQDMcZukqn3Wa4Z2y3wKljB/eoFnDRfNN\ B72OJLsfW6SnFRLKbXrgEnEP+7LevQEI0KsUq8NsgQmtx1btq\ lqyETdAgMBAAE=" Conditions: app_domain == "SCAMPI.MAPI" && op == "createFlow" -> "true"; KeyNote-Version: 2 Comment: OKE CL credential authorising client to load code of this type Authorizer: "rsa-base64:MEgCQQDMcZukqn3Wa4Z2y3wKljB/eoFnDRfNN\ B72OJLsfW6SnFRLKbXrgEnEP+7LevQEI0KsUq8NsgQmtx1btq\ lqyETdAgMBAAE=" Licensees: "rsa-base64:ABCDE12345" Conditions: app_domain == "SCAMPI.MAPI" && op == "createFlow" \ && param2 == " " -> "true"; Signature: "sig-rsa-sha1-base64:Du1uNVtNv8sAhjni/8UnzI9H+/VM\ 9GnSM/ppgfEOAmO/QzSESYZgrwsMEPlzAFqnbNGfwusxlXEIz\ delegated trust management using KeyNote and OpenSSL condition can be environment specific H. Bos – Leiden University 1/15/031

Environment Setup Code (ESC) H. Bos – Leiden University 1/15/031 ● policies implemented as ESC that is automatically prepended to user code – defines runtime support – explicitly declares API the code can use – removes the ability to ● declare/import new APIs ● access the 'private parts' of ESC ● perform unsafe operations ● 1 translation unit => whole program analysis - part 1: macro definitions expressing parameterisation - part 2: ESC - part 3: user code

OKE programming language H. Bos – Leiden University 1/15/031 ● many different user 'classes' with different trade-offs regarding the amount of restriction needed – students – system administrators – anonymous ● avoid special-purpose languages (rather: 1 language that can be customised) ● interfacing with rest of kernel important ● ideally something like C ● Cyclone (“a crash-free dialect of C”)

Language features for safety H. Bos – Leiden University 1/15/031 ● Cyclone: strongly typed, pointer protected, garbage collected, and provides region-based mem protection ● A measure of safety is provided by combination of existing Cyclone and new features ● Spatial pointer safety – bounded pointers – non-nullable pointers -> not checked – 'normal' C pointers -> always checked

Language features for safety H. Bos – Leiden University 1/15/031 ● Temporal pointer safety – region-based protection (e.g. to prevent returning the address of a local variable), added kernel region – RBP and GC work well for Cyclone-only, but present safety issues when interacting with C code – for example: suppose an OKE module holds a pointer to kernel memory – OKE solution: ● delayed freeing plus (place blocks on kill list) ● new GC: O(n) in # of allocated blocks) ● GC round just prior to activation of the OKE module (hmmm...) ● nullifies pointers or kills modules ● delayed freeing: not always needed

Language features for safety ● Language restrictions forbid construct, e.g.: – forbid extern “C” // no import of C APIs – forbid namespace...// no access to specific namespace – forbid catch...// do not catch certain exceptions ● API and entry point wrapping – potential entry points explicitly declared (pointers can only be taken of functions declared extern) – automatically wrapped in ESC (“wrap extern”) – kernel APIs may also be wrapped H. Bos – Leiden University 1/15/031

Language features for safety ● Sensitive data protection at compile time locked construct – sharing: parts of a data structure should be inaccessible – normal solution: anonymising – locked variables cannot be used in calculations and cannot be cast – may be declared const H. Bos – Leiden University 1/15/031

Language features for safety ● Stack overrun protection – some dynamic checking needed (but flexible) – 2 parameters: bound and granularity H. Bos – Leiden University 1/15/031

OKE features for safety ● timeout protection – multiple solutions ● dynamic checks in backward jumps ● timer interrupt: applied in Linux kernel ● other: applied in IXP1200 network processor – timer interrupt ● on return from interrupt: check if timeout is detected ● if so, jump to callback function registered by ESC ● this function may throw exception ● takes into account if code is executing kernel or OKE code H. Bos – Leiden University 1/15/031

FEC overhead over C H. Bos – Leiden University 1/15/03 1

Audio resampling overhead over C H. Bos – Leiden University 1/15/03 1

OKE sub-projects ● OKE Corral (“OKE, Click and a dash of active networks”) ● Diet OKE (“network processors”) OKE Corral: H. Bos – Leiden University 1/15/031

HOKE-POKE: applying OKE concepts to multiple levels push monitoring functionality to the microengines counters filters H. Bos – Leiden University 1/15/031

Advantages OKE may form a basis for resource control even when there are multiple, mutually mistrusting parties OKE provides resource control if required, while not incurring overhead, if not OKE authorisation procedures can be applied throughout SCAMPI OKE overhead can be very small indeed Disadvantages runtime resource control comes at a runtime cost writing ESC is complex In SCAMPI  // authorise any operation scampi_set_authorisation_creds(priv, pub, creds)  // load code (OKE or other) anywhere scampi_load_code (id, type, location, param) scampi_unload_code (id) Conclusions H. Bos – Leiden University 1/15/031

Diet OKE – multiple application simultaneous access to microengines – application granularity: microengine ● killing applications running on MEs – by control processor (StrongARM) ● packet access – prefiltering – locked fields (compile time) ● memory access – static memory allocation + protection in API – bounds checking at runtime ● stack is not a problem H. Bos – Leiden University 1/15/031

Diet OKE ● application framework: granularity = microengine ● 1 ME for packet reception ● 5 MEs for applications ● target: network monitors ● third parties can “plugin” their own functions ● 4 threads H. Bos – Leiden University 1/15/031

Diet OKE ● packets received in circular buffer structure in SRAM + SDRAM ● applications can read packets whenever data is available ● fields: – Count – flags: W, R*, Done* ● mopping mechanism.... H. Bos – Leiden University 1/15/031 receive mop

Diet OKE Throughput H. Bos – Leiden University 1/15/031

Diet OKE Applications H. Bos – Leiden University 1/15/031

Garbage collector ● mark and sweep, assumes strong typing ● automatically generated code based on whole program analysis (compiler front-end) ● compiler detects which types can be allocated by module – by enumerating types of new and malloc – generates marking functions for each type – defines how to scan mem block of specific type for pointers – contains call to GC for every pointer in type – mem allocation calls: pass * marking function to mem subsystem – GC time: call marking functions for each block H. Bos – Leiden University 1/15/031