SlideShare a Scribd company logo
1 of 31
Download to read offline
F9: A Secure and Efficient
Microkernel Built for Deeply
Embedded Systems
Jim Huang ( 黃敬群 ) <jserv.tw@gmail.com>
Dec 9, 2013 / CCU Taiwan
Aug 28, 2013 / JuluOSDev
Aug 3, 2013 / COSCUP
Rights to copy
Attribution – ShareAlike 3.0
You are free
to copy, distribute, display, and perform the work
to make derivative works
to make commercial use of the work
Under the following conditions
Attribution. You must give the original author credit.
Share Alike. If you alter, transform, or build upon this work, you may distribute the
resulting work only under a license identical to this one.
For any reuse or distribution, you must make clear to others the license terms of this work.
Any of these conditions can be waived if you get permission from the copyright holder.
Your fair use and other rights are in no way affected by the above.
License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
© Copyright 2013 0xlab
http://0xlab.org/
Corrections, suggestions, contributions and translations
are welcome!
Latest update: Dec 9, 2013
Goals of This Presentation
• Introduce F9 microkernel, new open source
implementation built from scratch, which deploys
modern kernel techniques, derived from L4
microkernel designs, to deeply embedded devices.
https://github.com/f9micro
• Characteristics of F9 microkernel
– Efficiency: performance + power consumption
– Security: memory protection + isolated execution
– Flexible development environment
Agenda
• Target: Deeply embedded devices
• Microkernel overview
• Characteristics of F9 Microkernel
Target: Deeply Embedded Devices
Deeply Embedded Devices
• Power awareness; solid and limited applications
• Multi-tasking or cooperative scheduling is still required
• IoT (Internet of Things) is the specialized derivative
with networking facility
• Communication capability is built-in for some products
• Example: AIRO wristband (health tracker)
http://www.weweartech.com/amazing­new­uses­smart­watches/
HRV Knows You
We built in-house OS for products and releases the
basic part as an open source effort
(invisible) Medical devices make sense in our life.
:: home-care :: advance warning :: security
(invisible) Medical devices make sense in our life.
:: home-care :: advance warning :: security
Microkernel Overview
Microkernel Concepts
• Minimal kernel and hardware enforce separation
• Only kernel runs in CPU privileged mode
• Components are user!level processes
• No restrictions on component software
• Reuse of legacy software
principle of least privilege (POLA)
A capability is a communicable, unforgeable token of authority. It refers
to a value that references an object along with an associated set of access
rights. A user program on a capability-based operating system must use a
capability to access an object.
Case Study: Bugs inside big kernels
• Drivers cause 85% of Windows XP crashes.
– Michael M. Swift, Brian N. Bershad, Henry M. Levy: “Improving the
Reliability of Commodity Operating Systems”, SOSP 2003
• Error rate in Linux drivers is 3x (maximum: 10x)
– Andy Chou, Junfeng Yang, Benjamin Chelf, Seth Hallem, Dawson R.
Engler: “An Empirical Study of Operating System Errors”, SOSP 2001
• Causes for driver bugs
– 23% programming error
– 38% mismatch regarding device specification
– 39% OS-driver-interface misconceptions
– Leonid Ryzhyk, Peter Chubb, Ihor Kuz and Gernot Heiser: “Dingo:
Taming device drivers”, EuroSys 2009
Monolithic Kernel vs. Microkernel
   
Microkernel Philosophy
A concept is tolerated inside the microkernel only if
moving it outside the kernel, i.e., permitting competing
implementations would prevent the implementation of
the systems' required functionality.
– Jochen Liedtke
Microkernel
• Minimalist approach
– IPC, virtual memory, thread scheduling
• Put the rest into user space
– Device drivers, networking, file system, user interface
• Disadvantages
– Lots of system calls and context switches
• Examples: Mach, L4, QNX, MINIX, IBM K42
3 Generations of Microkernel
• Mach (1985-1994)
– replace pipes with IPC (more general) 
– improved stability (vs monolithic kernels)
– poor performance
• L3 & L4 (1990-2001)
– order of magnitude improvement in IPC performance
• written in assembly, sacrificed CPU portability
• only synchronus IPC (build async on top of sync) 
– very small kernel: more functions moved to userspace
• seL4, Fiasco.OC, Coyotos, NOVA (2000-)
– platform independence
– verification, security, multiple CPUs, etc.
Microkernel Paging
• Microkernel forwards page fault to a pager server.
• Kernel or server decides which pages need to be
written to disk in low memory situations.
• Pager server handles writing pages to disk.
Recursive Address Space
• Initial address space controlled by first process.
– Controls all available memory.
– Other address spaces empty at boot.
• Other processes obtain memory pages from first or
from their other processes that got pages from first.
• Why is memory manager flexibility useful?
– Different applications: real-time, multimedia, disk cache.
Grant
Map
Flush
Characteristics of F9 Microkernel
4 Aspects
• BSD Licensing (two-clause), suitable for both research
and commercial usage.
• Efficiency
– performance: fast IPC and well-structured designs
– energy-saving: tickless scheduling, adaptive power
management
• Security
– memory protection: MPU guarded
– Isolated execution: L4 based, capabilities model
• Flexible development
– Kprobes
– profile-directed optimizations
Why are current systems unreliable?
• Systems are huge
– No single person can understand the whole system
> F9 Microkernel has only 2K LoC of portable C
• Bug fixes usually introduce new bugs.
> F9 introduces execution domains and on-the-fly patches
• Poor fault isolation
– No isolation between system components
– OS contains hundreds of procedures linked together as a
single binary program running on the kernel mode.
> F9 is built from scratch and well-engineered for isolation
F9 Microkernel
Parent
Partition
Applications VM Worker
Process
File system
Server
VM Worker
Process
Application
Framework
Memory Manament
server
(Interrupts)
Scheduling
Policy
Unstrused Domain
F9 Microkernel Architecture
Media
Driver
Network
Driver
Network
Stack
Board
specific
Trusted Domain
Task Manament
KProbes
In-kernel
debugger
User
Space
Kernel
Space
Principles
• F9 follows the fundamental principles of L4
microkernels
– implements address spaces, thread management,
and IPC only in the privileged kernel.
• Designed and customized for ARM Cortex-M,
supporting NVIC (Nested Vectored Interrupt
Controller), Bit Banding, MPU (Memory Protection
Unit)
Thread
• Each thread has its own TCB (Thread Control Block)
and addressed by its global id.
• Also dispatcher is responsible for switching contexts.
Threads with the same priority are executed in a
round-robin fashion.
Memory Management
• split into three concepts:
– Memory pool, which represent area of physical address space
with specific attributes.
– Flexible page, which describes an always size aligned region of
an address space. Unlike other L4 implementations, flexible pages
in F9 represent MPU region instead.
– Address space, which is made up of these flexible pages.
• System calls are provided to manage address spaces:
– Grant: memory page is granted to a new user and cannot be used
anymore by its former user.
– Map: This implements shared memory – the memory page is
passed to another task but can be used by both tasks.
– Flush: The memory page that has been mapped to other users
will be flushed out of their address space.
IPC
• The concept of UTCB (user-level thread-control
blocks) is being taken on. A UTCB is a small thread-
specific region in the thread's virtual address space,
which is always mapped. Therefore, the access to the
UTCB can never raise a page fault, which makes it
perfect for the kernel to access system-call arguments,
in particular IPC payload copied from/to user threads.
• Kernel provides synchronous IPC (inter-process
communication), for which short IPC carries payload in
CPU registers only and full IPC copies message
payload via the UTCBs of the communicating parties.
Realtime: overload tolerance
• Hard realtime must be based on worst-case analysis
• overload must be tolerated gracefully and predictable
• Applications can be split into mandatory and optional
parts
3535
Hermann
Härtig
et al.
mult.
TU
Dresden
Operating
Systems
Group
SEVECOM
Budapest
wcet 95%
Energy efficiency: Tickless
• Introduce tickless timer which allow the ARM Cortex-M
to wake up only when needed, either at a scheduled
time or on an interrupt event.
• Therefore, it results in better current consumption than
the common approach using the system timer,
SysTick, which requires a constantly running and high
frequency clock.
Kprobes: dynamic instrumentation
• Inspired by Linux Kernel, allowing developers to gather
additional information about kernel operation without
recompiling or rebooting the kernel.
• It enables locations in the kernel to be instrumented
with code, and the instrumentation code runs when the
ARM core encounters that probe point.
• Once the instrumentation code completes execution,
the kernel continues normal execution.
Debugging and profiling mechanisms
• configurable debug console
• memory dump
• thread profiling
– name, uptime, stack allocated/current/used
• memory profiling
– kernel table, pool free/allocated size, fragmentation
Reference
• From L3 to seL4: What Have We Learnt in 20 Years of
L4 Microkernels? Kevin Elphinstone and Gernot
Heiser, NICTA/UNSW
• Microkernel Construction"
http://os.inf.tu-dresden.de/Studium/MkK/
• Microkernel-based Operating Systems
http://www.inf.tu-dresden.de/index.php?node_id=1314
• The L4 Microkernel, Hermann Härtig, Technische
Universität Dresden
• Microkernels, Arun Krishnamurthy, University of
Central Florida

More Related Content

What's hot

Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/SpringPacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
Takatoshi Matsuo
 
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
Etsuji Nakai
 

What's hot (20)

root権限無しでKubernetesを動かす
root権限無しでKubernetesを動かす root権限無しでKubernetesを動かす
root権限無しでKubernetesを動かす
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
Function Level Analysis of Linux NVMe Driver
Function Level Analysis of Linux NVMe DriverFunction Level Analysis of Linux NVMe Driver
Function Level Analysis of Linux NVMe Driver
 
LFCollab14: Xen vs Xen Automotive
LFCollab14: Xen vs Xen AutomotiveLFCollab14: Xen vs Xen Automotive
LFCollab14: Xen vs Xen Automotive
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
java.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javajava.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷java
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
 
Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/SpringPacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
Pacemaker+PostgreSQLレプリケーションで共有ディスクレス高信頼クラスタの構築@OSC 2013 Tokyo/Spring
 
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
30分でRHEL6 High Availability Add-Onを超絶的に理解しよう!
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
RHEL7/CentOS7 NetworkManager徹底入門
RHEL7/CentOS7 NetworkManager徹底入門RHEL7/CentOS7 NetworkManager徹底入門
RHEL7/CentOS7 NetworkManager徹底入門
 
05.2 virtio introduction
05.2 virtio introduction05.2 virtio introduction
05.2 virtio introduction
 
Linux Namespace
Linux NamespaceLinux Namespace
Linux Namespace
 
Xdp and ebpf_maps
Xdp and ebpf_mapsXdp and ebpf_maps
Xdp and ebpf_maps
 
containerdの概要と最近の機能
containerdの概要と最近の機能containerdの概要と最近の機能
containerdの概要と最近の機能
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
[오픈소스컨설팅]Zabbix Installation and Configuration Guide
[오픈소스컨설팅]Zabbix Installation and Configuration Guide[오픈소스컨설팅]Zabbix Installation and Configuration Guide
[오픈소스컨설팅]Zabbix Installation and Configuration Guide
 

Viewers also liked

Viewers also liked (20)

Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
Construct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoTConstruct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoT
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU ToolchainHow A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
 
Hints for L4 Microkernel
Hints for L4 MicrokernelHints for L4 Microkernel
Hints for L4 Microkernel
 
olibc: Another C Library optimized for Embedded Linux
olibc: Another C Library optimized for Embedded Linuxolibc: Another C Library optimized for Embedded Linux
olibc: Another C Library optimized for Embedded Linux
 
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 

Similar to F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems

Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
CSCJournals
 
Microx - A Unix like kernel for Embedded Systems written from scratch.
Microx - A Unix like kernel for Embedded Systems written from scratch.Microx - A Unix like kernel for Embedded Systems written from scratch.
Microx - A Unix like kernel for Embedded Systems written from scratch.
Waqar Sheikh
 

Similar to F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems (20)

MIcrokernel
MIcrokernelMIcrokernel
MIcrokernel
 
Operating system 15 micro kernel based os
Operating system 15 micro kernel based osOperating system 15 micro kernel based os
Operating system 15 micro kernel based os
 
In a monolithic kerne1
In a monolithic kerne1In a monolithic kerne1
In a monolithic kerne1
 
In a monolithic kerne1
In a monolithic kerne1In a monolithic kerne1
In a monolithic kerne1
 
Kernel (OS)
Kernel (OS)Kernel (OS)
Kernel (OS)
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categories
 
ITT Project Information Technology Basic
ITT Project Information Technology BasicITT Project Information Technology Basic
ITT Project Information Technology Basic
 
Embedded Operating System-Kernel Features.pptx
Embedded Operating System-Kernel Features.pptxEmbedded Operating System-Kernel Features.pptx
Embedded Operating System-Kernel Features.pptx
 
Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
Analysis of Practicality and Performance Evaluation for Monolithic Kernel and...
 
Symmetric multiprocessing and Microkernel
Symmetric multiprocessing and MicrokernelSymmetric multiprocessing and Microkernel
Symmetric multiprocessing and Microkernel
 
Microx - A Unix like kernel for Embedded Systems written from scratch.
Microx - A Unix like kernel for Embedded Systems written from scratch.Microx - A Unix like kernel for Embedded Systems written from scratch.
Microx - A Unix like kernel for Embedded Systems written from scratch.
 
Microkernel
MicrokernelMicrokernel
Microkernel
 
Os file
Os fileOs file
Os file
 
Kernel (computing)
Kernel (computing)Kernel (computing)
Kernel (computing)
 
Kernel (computing)
Kernel (computing)Kernel (computing)
Kernel (computing)
 
Walking around linux kernel
Walking around linux kernelWalking around linux kernel
Walking around linux kernel
 
os_1.pdf
os_1.pdfos_1.pdf
os_1.pdf
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
2. microkernel new
2. microkernel new2. microkernel new
2. microkernel new
 
Exokernel Operating System (1)
Exokernel Operating System (1)Exokernel Operating System (1)
Exokernel Operating System (1)
 

More from National Cheng Kung University

More from National Cheng Kung University (8)

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Open Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to EcosystemOpen Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to Ecosystem
 
Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)
 
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
 
Faults inside System Software
Faults inside System SoftwareFaults inside System Software
Faults inside System Software
 
Develop Your Own Operating System
Develop Your Own Operating SystemDevelop Your Own Operating System
Develop Your Own Operating System
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems

  • 1. F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems Jim Huang ( 黃敬群 ) <jserv.tw@gmail.com> Dec 9, 2013 / CCU Taiwan Aug 28, 2013 / JuluOSDev Aug 3, 2013 / COSCUP
  • 2. Rights to copy Attribution – ShareAlike 3.0 You are free to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode © Copyright 2013 0xlab http://0xlab.org/ Corrections, suggestions, contributions and translations are welcome! Latest update: Dec 9, 2013
  • 3. Goals of This Presentation • Introduce F9 microkernel, new open source implementation built from scratch, which deploys modern kernel techniques, derived from L4 microkernel designs, to deeply embedded devices. https://github.com/f9micro • Characteristics of F9 microkernel – Efficiency: performance + power consumption – Security: memory protection + isolated execution – Flexible development environment
  • 4. Agenda • Target: Deeply embedded devices • Microkernel overview • Characteristics of F9 Microkernel
  • 6. Deeply Embedded Devices • Power awareness; solid and limited applications • Multi-tasking or cooperative scheduling is still required • IoT (Internet of Things) is the specialized derivative with networking facility • Communication capability is built-in for some products • Example: AIRO wristband (health tracker) http://www.weweartech.com/amazing­new­uses­smart­watches/
  • 8. We built in-house OS for products and releases the basic part as an open source effort (invisible) Medical devices make sense in our life. :: home-care :: advance warning :: security (invisible) Medical devices make sense in our life. :: home-care :: advance warning :: security
  • 10. Microkernel Concepts • Minimal kernel and hardware enforce separation • Only kernel runs in CPU privileged mode • Components are user!level processes • No restrictions on component software • Reuse of legacy software
  • 11. principle of least privilege (POLA) A capability is a communicable, unforgeable token of authority. It refers to a value that references an object along with an associated set of access rights. A user program on a capability-based operating system must use a capability to access an object.
  • 12. Case Study: Bugs inside big kernels • Drivers cause 85% of Windows XP crashes. – Michael M. Swift, Brian N. Bershad, Henry M. Levy: “Improving the Reliability of Commodity Operating Systems”, SOSP 2003 • Error rate in Linux drivers is 3x (maximum: 10x) – Andy Chou, Junfeng Yang, Benjamin Chelf, Seth Hallem, Dawson R. Engler: “An Empirical Study of Operating System Errors”, SOSP 2001 • Causes for driver bugs – 23% programming error – 38% mismatch regarding device specification – 39% OS-driver-interface misconceptions – Leonid Ryzhyk, Peter Chubb, Ihor Kuz and Gernot Heiser: “Dingo: Taming device drivers”, EuroSys 2009
  • 13. Monolithic Kernel vs. Microkernel    
  • 14. Microkernel Philosophy A concept is tolerated inside the microkernel only if moving it outside the kernel, i.e., permitting competing implementations would prevent the implementation of the systems' required functionality. – Jochen Liedtke
  • 15. Microkernel • Minimalist approach – IPC, virtual memory, thread scheduling • Put the rest into user space – Device drivers, networking, file system, user interface • Disadvantages – Lots of system calls and context switches • Examples: Mach, L4, QNX, MINIX, IBM K42
  • 16. 3 Generations of Microkernel • Mach (1985-1994) – replace pipes with IPC (more general)  – improved stability (vs monolithic kernels) – poor performance • L3 & L4 (1990-2001) – order of magnitude improvement in IPC performance • written in assembly, sacrificed CPU portability • only synchronus IPC (build async on top of sync)  – very small kernel: more functions moved to userspace • seL4, Fiasco.OC, Coyotos, NOVA (2000-) – platform independence – verification, security, multiple CPUs, etc.
  • 17. Microkernel Paging • Microkernel forwards page fault to a pager server. • Kernel or server decides which pages need to be written to disk in low memory situations. • Pager server handles writing pages to disk.
  • 18. Recursive Address Space • Initial address space controlled by first process. – Controls all available memory. – Other address spaces empty at boot. • Other processes obtain memory pages from first or from their other processes that got pages from first. • Why is memory manager flexibility useful? – Different applications: real-time, multimedia, disk cache. Grant Map Flush
  • 19. Characteristics of F9 Microkernel
  • 20. 4 Aspects • BSD Licensing (two-clause), suitable for both research and commercial usage. • Efficiency – performance: fast IPC and well-structured designs – energy-saving: tickless scheduling, adaptive power management • Security – memory protection: MPU guarded – Isolated execution: L4 based, capabilities model • Flexible development – Kprobes – profile-directed optimizations
  • 21. Why are current systems unreliable? • Systems are huge – No single person can understand the whole system > F9 Microkernel has only 2K LoC of portable C • Bug fixes usually introduce new bugs. > F9 introduces execution domains and on-the-fly patches • Poor fault isolation – No isolation between system components – OS contains hundreds of procedures linked together as a single binary program running on the kernel mode. > F9 is built from scratch and well-engineered for isolation
  • 22. F9 Microkernel Parent Partition Applications VM Worker Process File system Server VM Worker Process Application Framework Memory Manament server (Interrupts) Scheduling Policy Unstrused Domain F9 Microkernel Architecture Media Driver Network Driver Network Stack Board specific Trusted Domain Task Manament KProbes In-kernel debugger User Space Kernel Space
  • 23. Principles • F9 follows the fundamental principles of L4 microkernels – implements address spaces, thread management, and IPC only in the privileged kernel. • Designed and customized for ARM Cortex-M, supporting NVIC (Nested Vectored Interrupt Controller), Bit Banding, MPU (Memory Protection Unit)
  • 24. Thread • Each thread has its own TCB (Thread Control Block) and addressed by its global id. • Also dispatcher is responsible for switching contexts. Threads with the same priority are executed in a round-robin fashion.
  • 25. Memory Management • split into three concepts: – Memory pool, which represent area of physical address space with specific attributes. – Flexible page, which describes an always size aligned region of an address space. Unlike other L4 implementations, flexible pages in F9 represent MPU region instead. – Address space, which is made up of these flexible pages. • System calls are provided to manage address spaces: – Grant: memory page is granted to a new user and cannot be used anymore by its former user. – Map: This implements shared memory – the memory page is passed to another task but can be used by both tasks. – Flush: The memory page that has been mapped to other users will be flushed out of their address space.
  • 26. IPC • The concept of UTCB (user-level thread-control blocks) is being taken on. A UTCB is a small thread- specific region in the thread's virtual address space, which is always mapped. Therefore, the access to the UTCB can never raise a page fault, which makes it perfect for the kernel to access system-call arguments, in particular IPC payload copied from/to user threads. • Kernel provides synchronous IPC (inter-process communication), for which short IPC carries payload in CPU registers only and full IPC copies message payload via the UTCBs of the communicating parties.
  • 27. Realtime: overload tolerance • Hard realtime must be based on worst-case analysis • overload must be tolerated gracefully and predictable • Applications can be split into mandatory and optional parts 3535 Hermann Härtig et al. mult. TU Dresden Operating Systems Group SEVECOM Budapest wcet 95%
  • 28. Energy efficiency: Tickless • Introduce tickless timer which allow the ARM Cortex-M to wake up only when needed, either at a scheduled time or on an interrupt event. • Therefore, it results in better current consumption than the common approach using the system timer, SysTick, which requires a constantly running and high frequency clock.
  • 29. Kprobes: dynamic instrumentation • Inspired by Linux Kernel, allowing developers to gather additional information about kernel operation without recompiling or rebooting the kernel. • It enables locations in the kernel to be instrumented with code, and the instrumentation code runs when the ARM core encounters that probe point. • Once the instrumentation code completes execution, the kernel continues normal execution.
  • 30. Debugging and profiling mechanisms • configurable debug console • memory dump • thread profiling – name, uptime, stack allocated/current/used • memory profiling – kernel table, pool free/allocated size, fragmentation
  • 31. Reference • From L3 to seL4: What Have We Learnt in 20 Years of L4 Microkernels? Kevin Elphinstone and Gernot Heiser, NICTA/UNSW • Microkernel Construction" http://os.inf.tu-dresden.de/Studium/MkK/ • Microkernel-based Operating Systems http://www.inf.tu-dresden.de/index.php?node_id=1314 • The L4 Microkernel, Hermann Härtig, Technische Universität Dresden • Microkernels, Arun Krishnamurthy, University of Central Florida