Noah Hypervisor-Based Darwin Subsystem for Linux Takaya Saeki, - - PowerPoint PPT Presentation

noah
SMART_READER_LITE
LIVE PREVIEW

Noah Hypervisor-Based Darwin Subsystem for Linux Takaya Saeki, - - PowerPoint PPT Presentation

Noah Hypervisor-Based Darwin Subsystem for Linux Takaya Saeki, Yuichi Nishiwaki Self Introduction Noah Development Team Takaya Saeki Yuichi Nishiwaki They both are graduate students at the University of Tokyo. They are developing Noah in


slide-1
SLIDE 1

Noah

Hypervisor-Based Darwin Subsystem for Linux

Takaya Saeki, Yuichi Nishiwaki

slide-2
SLIDE 2

Self Introduction

Noah Development Team Takaya Saeki Yuichi Nishiwaki

They both are graduate students at the University of

  • Tokyo. They are developing Noah in their free time.

Noah was selected one of MITOH projects, which is a financial assistance program by the government of Japan for outstanding young programmers

slide-3
SLIDE 3

Noah

  • A middleware that runs 


unmodified Linux ELF applications on macOS

  • Reduce cost of creating / waiting for mac OS port of

Linux apps

  • Accomplish it by special hypervisor. Load ELF

binary into VM and let it run instead of kernel, trap system calls from it by hypervisor, and translate them to corresponding system calls on macOS.

slide-4
SLIDE 4

Noah

  • A middleware that runs 


unmodified Linux ELF applications on macOS

  • Reduce cost of creating / waiting for mac OS port of

Linux apps

  • Accomplish it by special hypervisor. Load ELF

binary into VM and let it run instead of kernel, trap system calls from it by hypervisor, and translate them to corresponding system calls on macOS.

We discuss the architecture in detail later!

slide-5
SLIDE 5

Short Demo; 
 What it looks like

slide-6
SLIDE 6

Agenda

  • What is Noah (Done!)
  • Background
  • Noah in Detail
  • Architecture Overview
  • Advantages of Noah Architecture
  • Subsystem Implementation
  • Memory management, VFS, and the other
  • Current Implementation Status and Performance
  • Related Technologies and Comparison 


(Windows Subsystem for Linux, Linuxulator, and so on)

  • Their Possible Impact on Cross Platform Development
slide-7
SLIDE 7

Background

slide-8
SLIDE 8

Linux

  • One of the most important operating systems today
  • Most popular OS for WEB servers
  • Many apps and middleware come from the Linux

ecosystem, and they are ported to other operating systems for developers

slide-9
SLIDE 9

Problem: Porting cost

Later..

slide-10
SLIDE 10

Porting cost

  • Many Linux applications are ported to macOS,

FreeBSD, and Windows…

  • But it takes time and effort!
  • Windows decided to have Linux compatibility layer

called “Windows Subsystem for Linux” in 2016 to benefit from the Linux ecosystem directly

  • FreeBSD also already has Linux compatibility layer
slide-11
SLIDE 11
  • macOS does not have Linux

compatibility layer yet despite its large number of developers

  • Noah fills the missing piece!
slide-12
SLIDE 12

If major operating systems have Linux compatibility, developers don’t have to port Linux applications nor wait for them to be ported

slide-13
SLIDE 13

Architecture Overview 


  • f Noah
slide-14
SLIDE 14

Architecture Overview

Noah’s architecture consists of three components

  • 1. VT-x Virtual Machines

They have NO kernel inside it, but directly boot an ELF binary and let it run instead.

  • 2. Host Noah Processes

Processes that run on the host OS, which actually work as Linux compatibility layer

  • 3. Virtual Machine Monitor module (VMM).

Actually, not a part of Noah itself, but a kernel API of the host OS for virtualization. Apple Hypervisor Framework in macOS, KVM in Linux, for example.

slide-15
SLIDE 15

Architecture Overview

  • 1. Host Noah process

launches a new VM and loads ELF inside it by ELF loader implemented in the host Noah process

  • 2. The VM runs ELF in its

virtualized userland

  • 3. The ELF application fires

Linux system calls when running

  • 4. VMM module traps the

system call and passes it to the host Noah process

  • 5. Host Noah process

emulates the behavior of Linux system call by host OS’s system calls

slide-16
SLIDE 16

Architecture Overview

A pair of host Noah process and VM corresponds to a Linux application. So, when there are multiple Linux applications, there are also multiple pairs of host Noah process and VM.

slide-17
SLIDE 17

$ noah /bin/hello Noah

macOS

hello

glibc

6 6 write(1, “hello”, 6)

Example1: How “Hello, world” works

stack area

slide-18
SLIDE 18

$ cat file | grep 2017 Noah

macOS

bash

Noah

Noah forks!

Example2: Interaction between processes

slide-19
SLIDE 19

Example2: Interaction between processes

$ cat file | grep 2017 Noah

macOS

bash

Noah

bash

Clone the VM state

slide-20
SLIDE 20

$ cat file | grep 2017 Noah

macOS

bash

Noah

cat

exec!

Example2: Interaction between processes

slide-21
SLIDE 21

$ cat file | grep 2017 Noah

macOS

bash

Noah

cat

Noah

grep

Example2: Interaction between processes

slide-22
SLIDE 22

$ cat file | grep 2017 Noah

macOS

bash

Noah

cat

Noah

grep

Example2: Interaction between processes

slide-23
SLIDE 23

Example2: Interaction between processes

$ cat file | grep 2017 Noah

macOS

bash

Noah

cat

Mac App Linux and macOS applications can also communicate naturally

slide-24
SLIDE 24

Advantages of Noah Architecture

slide-25
SLIDE 25

Unique Characteristics

  • 1. All syscall translation done in user land instead of

kernel land

  • Still, any sensitive events are trappable with VT-x
  • 2. Launch as many VMs as virtual Linux processes
  • No kernel running inside VMs
  • 3. Virtualization is per syscall, not per device I/O
  • No care about hardware device emulation
slide-26
SLIDE 26

Advantages of Noah Architecture

  • 1. Robustness

Bugs in Noah never cause kernel panic because Noah is just an ordinary userland program (let’s google “WSL bluescreen” now).

  • 2. Portability

The architecture is independent from host OS’s architecture. Syscall calling convention, memory layout, page fault handling rules, …etc are all configurable.

  • 3. Smooth interaction with host OS

Linux process runs as if it is the host OS’s process. Resources such as memory, network, and so on are managed by host OS. No need to worry about the amount of virtual memory allocation like full virtual machines.

slide-27
SLIDE 27

Agenda

  • What is Noah
  • Background
  • Noah in Detail
  • Architecture Overview
  • Advantages of Noah Architecture
  • Subsystem Implementation
  • Memory management, VFS, and the other
  • Current Implementation Status and Performance
  • Related Technologies and Comparison 


(Windows Subsystem for Linux, Linuxulator, and so on)

  • Their Possible Impact on Cross Platform Development
slide-28
SLIDE 28

Subsystem Implementation

slide-29
SLIDE 29

Noah Subsystems

Noah consists of subsystems such as memory management, IPC, or file system just like a real kernel.
 
 Some of them have some difficulty because of the nature of Noah’s architecture.

slide-30
SLIDE 30

Noah Subsystems

Today we explain two subsystems in detail.

  • 1. Memory management
  • 2. Virtual file system
slide-31
SLIDE 31

Memory Management

slide-32
SLIDE 32

Memory Management

  • Since Linux ELF binary runs inside VM, Noah must

manage address translation between the VM memory space and the host memory space

  • It gives us Copy on Write ability, Efficient exec

implementation, but also some difficulty

slide-33
SLIDE 33

Guest Virtual Memory Guest Physical Memory Host Physical Memory

Guest Host

48bit 39bit ≦39bit

Memory Translation

LINUX APPLICATION

Duplicated Address Translation!

slide-34
SLIDE 34

LINUX APPLICATION

Guest Virtual Memory Guest Physical Memory Host Physical Memory

Guest Host

48bit 39bit ≦39bit

=

Disable

Memory Translation

Straight Mapping

slide-35
SLIDE 35

Guest Virtual Memory Guest Physical Memory Host Physical Memory

Guest Host

48bit 39bit ≦39bit

=

Memory Translation

LINUX APPLICATION

Single Address Translation

slide-36
SLIDE 36

Virtual File System

slide-37
SLIDE 37

from user

resolve_path flag_conv strncpy_from_user fs.ops.open

Symlinks & Mountpoints to user OOP

Virtual File System

  • open system call
slide-38
SLIDE 38

/ usr etc Users dev tmp /Users /dev ~/.noah/tree/usr ~/.noah/tree/etc /tmp

Virtual File System

slide-39
SLIDE 39

Other System Calls

Just call macOS’s one getuid getpid alarm semget getpgid getgid time Need conversion futex emulate with conditional value socket integrate with VFS sigaction create signal frame inside VM gettid generate from threadid

slide-40
SLIDE 40

Current Implementation Status of Noah

slide-41
SLIDE 41

Current Implementation Status of Noah

  • Still in development
  • Currently capable of running
  • apt-get, pacman (Not all subcommands are supported yet)
  • vim, gcc, make
  • Ruby
  • Binutils, ls, cat, …
  • X applications; xeyes, xclock, xfwrite, doom 3, …
  • sudo, curl, nc, man, …
  • The most easiest way to build Linux kernel on macOS is to use Noah!
slide-42
SLIDE 42

Performance

  • Performance data will be public in the presentation

since it contains unpublished materials

slide-43
SLIDE 43

Agenda

  • What is Noah
  • Background
  • Noah in Detail
  • Architecture Overview
  • Advantages of Noah Architecture
  • Subsystem Implementation
  • Memory management, VFS, and the other
  • Current Implementation Status and Performance
  • Related Technologies and Comparison 


(Windows Subsystem for Linux, Linuxulator, and so on)

  • Their Possible Impact on Cross Platform Development
slide-44
SLIDE 44

Related Technologies

slide-45
SLIDE 45

Linux Compatibility Layers

  • OS Built-in
  • Windows Subsystem for Linux
  • FreeBSD’s Linuxulator
  • Third Party Middleware
  • Foreign LINUX
slide-46
SLIDE 46

Windows Subsystem for Linux (WSL)

  • Built-in Linux compatibility layer for Windows 10 by Microsoft
  • Picoprocess contains a Linux ELF binary. Kernel drivers (LXCore and LXSS)

handle system calls from it in kernel mode

Quoted from https://blogs.msdn.microsoft.com/wsl/2016/04/22/windows-subsystem-for-linux-overview/

slide-47
SLIDE 47

Linuxulator

  • Built-in Linux compatibility layer for FreeBSD
  • FreeBSD has a loader for Linux ELF and

implementations of Linux system calls

  • Similar approach to WSL’s LXSS / LXCore

(Linuxulator is older, though)

slide-48
SLIDE 48

Foreign Linux

  • https://github.com/wishstudio/flinux
  • Run unmodified Linux applications on Windows by

dynamic binary translation and system call emulation

  • It seems that the overhead of dynamic binary

translation is a bit heavy, however…

slide-49
SLIDE 49

Comparison

OS

Binary Compatibility

Portable No Kernel Modification Smooth Interaction Low 
 Overhead

Noah macOS

✔ ✔ ✔ ✔ ✔

WSL Windows

✔ ✗ ✗ ✔ ✔

Linuxulator FreeBSD

✔ ✗ ✗ ✔ ✔

Foreign LINUX Windows

✔ ✔ ✔ ✔ ✗

Full VM Any

✔ ✔ ✔ ✗ ✔

*with processor hardware virtualization

slide-50
SLIDE 50

Future Cross Platform Development

slide-51
SLIDE 51

Now major four operating systems have Linux compatibility

slide-52
SLIDE 52
  • Linux could be regarded as “standard” like POSIX
  • In the future, once you write a Linux application, it

simply could run any platforms

  • Noah could help it!
slide-53
SLIDE 53

Summary

  • We introduced Noah, which is a middleware that

runs unmodified Linux ELF applications on macOS

  • Noah adopts a new hypervisor based approach with

many merits

  • Now four major operating systems have Linux
  • compatibility. In the future, your Linux applications

could run anywhere!