Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace...

55
Microkernel virtualization under one roof - dare the impossible - Alexander Böttcher <[email protected]>

Transcript of Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace...

Page 1: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Microkernel virtualization under one roof- dare the impossible -

Alexander Böttcher<[email protected]>

Page 2: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 2

Page 3: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 3

Page 4: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Motivation

Off-the-shell virtualization solution ridden with complexity.

Application of virtualization call for trustworthy solutions.

Complexity defeats trust.

Alternative approach→ Microkernels with hardware assisted virtualization extensions

Microkernel virtualization under one roof - dare the impossible - 4

Page 5: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Component based virtualization architecture

non-root mode

root mode

kernel

NOVA Microhypervisor

9,000 SLOC

Resource managementApps Drivers

VMMVMM VMM

Guest OS Guest OS Guest OS

Microkernel virtualization under one roof - dare the impossible - 5

Page 6: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Genode OS framework

Microkernel virtualization under one roof - dare the impossible - 6

Page 7: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

General supported kernels on Genode

Microkernel virtualization under one roof - dare the impossible - 7

Page 8: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Kernels with hardware assisted virtualization

Microkernel virtualization under one roof - dare the impossible - 8

Page 9: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM inventory of Genode

Hardware assisted virtualization/separation support

Microkernel Host VMM Guest vCPUhw ARM, 32bit custom 1, 32bithw/trustzone ARM, 32bit custom 1, 32bithw with Muen Intel, 64bit VBox 4 1, 32bit

Seoul N, 32bitNOVA Intel & AMD VBox 4 N, 32bit, 64 bit

32bit, 64bit VBox 5 N, 32bit, 64 bit

Microkernel virtualization under one roof - dare the impossible - 9

Page 10: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Research challenge

Vision: VMMs runnable on all kernels w/o re-compilation

Focus on x86 microkernels for now→ NOVA, seL4, Fiasco.OC, and -hw-

Approach: Generalize VM interface as used by -hw-

Microkernel virtualization under one roof - dare the impossible - 10

Page 11: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Research challenge

Vision: VMMs runnable on all kernels w/o re-compilation

Focus on x86 microkernels for now→ NOVA, seL4, Fiasco.OC, and -hw-

Approach: Generalize VM interface as used by -hw-

Microkernel virtualization under one roof - dare the impossible - 10

Page 12: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Research challenge

Vision: VMMs runnable on all kernels w/o re-compilation

Focus on x86 microkernels for now→ NOVA, seL4, Fiasco.OC, and -hw-

Approach: Generalize VM interface as used by -hw-

Microkernel virtualization under one roof - dare the impossible - 10

Page 13: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 11

Page 14: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Flow of a virtualization event

User-level VMM Guest OS

NOVA

UTCB

UTCB

VMCS

world switch

copy

Microkernel virtualization under one roof - dare the impossible - 12

Page 15: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

vCPU state on NOVA

VMMUTCB

kernel space

user space

NOVA microhypervisor

UTCBVMCS/VMCB

Transfer: UTCB, VMCS/VMCB agnostic, partial state support

Microkernel virtualization under one roof - dare the impossible - 13

Page 16: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

vCPU state on Fiasco.OC

VMMUTCB

vCPU state

kernel space

user space

Fiasco.OC microkernel

UTCB

vCPU stateVMCS/VMCB

Transfer: vCPU state, not VMCS/VMCB agnostic, full state

Microkernel virtualization under one roof - dare the impossible - 14

Page 17: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

vCPU state on seL4

VMMIPCBuffer

kernel space

user space

seL4 microkernel

IPCBuffer

vCPU stateVMCS

Transfer: hybrid - IPCBuffer & syscall per VMCS registerIPCBuffer: VM exit - 17 registers, VM enter - 3 registers

Microkernel virtualization under one roof - dare the impossible - 15

Page 18: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on NOVA

VMMUTCB

kernel space

user space

NOVA microhypervisor

UTCBVMCS/VMCB

thread

vCPU

IPC call

IPC reply

Microkernel virtualization under one roof - dare the impossible - 16

Page 19: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on Fiasco.OC

VMMUTCB

vCPU state

kernel space

user space

Fiasco.OC microkernel

UTCB

vCPU stateVMCS/VMCB

thread

vCPU

syscall done

vmresume

(blocking)

Microkernel virtualization under one roof - dare the impossible - 17

Page 20: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on seL4

VMMIPCBuffer

kernel space

user space

seL4 microkernel

IPCBuffer

vCPU stateVMCS

thread

vCPU

syscall done

vmenter

(blocking)

Microkernel virtualization under one roof - dare the impossible - 18

Page 21: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on Genode’s -hw-

VMMUTCB

vCPU state

kernel space

user space

Genode’s -hw- microkernel (ARM)

UTCB

vCPU state

thread

vCPU

signal

run

Microkernel virtualization under one roof - dare the impossible - 19

Page 22: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 20

Page 23: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Design goals

VMM → just a component

Genode components designed event drivenNon-blocking thread (entrypoint) register for event sourcesEvents cause transition in state machineState transition by Genode signal or RPC

VM event → just another event sourceI/O event → just another event source

Kernel agnostic ABIUnified vCPU state per platform

Microkernel virtualization under one roof - dare the impossible - 21

Page 24: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Design goals

VMM → just a component

Genode components designed event drivenNon-blocking thread (entrypoint) register for event sourcesEvents cause transition in state machineState transition by Genode signal or RPC

VM event → just another event sourceI/O event → just another event source

Kernel agnostic ABIUnified vCPU state per platform

Microkernel virtualization under one roof - dare the impossible - 21

Page 25: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Envisioned vCPU handling

VMM

timer network

kernel

kernel space

user space

entrypoint

vCPU0 vCPUn

VM event

signal signal

Microkernel virtualization under one roof - dare the impossible - 22

Page 26: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Envisioned vCPU handling - multi core

VMM

kernel space

user space

kernel

entrypoint A

vCPU A0 ... vCPU An

entrypoint B

vCPU B0 ... vCPU Bn

Microkernel virtualization under one roof - dare the impossible - 23

Page 27: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VM interface - kernel agnostic

VMM

kernel space

user space

kernel

ld.lib.soVM interface

Entrypoint

vCPU0 ... vCPUn

Genode -base- library with unified ABI in ld.lib.so

Microkernel virtualization under one roof - dare the impossible - 24

Page 28: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VM interface - kernel agnostic

VM connection/session → VM address space establishedcreate_vcpu() - setup new vCPUscpu_state() - access to guest stateattach/detach() - memory management of VMVM_handler class - registration for VM event handlingrun/pause() - control execution of vCPUs - non-blocking

Microkernel virtualization under one roof - dare the impossible - 25

Page 29: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VM interface - kernel agnostic

VMM

ld.lib.soVM interface (client)

init

coreVM interface (server)

connection

kernel

kernel space

user space

entrypoint

Microkernel virtualization under one roof - dare the impossible - 26

Page 30: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VM interface - kernel agnostic

VMM

ld.lib.soVM interface (client)

init

coreVM interface (server)

VM session

kernel

kernel space

user space

entrypoint

vCPU0 ... vCPUn

Microkernel virtualization under one roof - dare the impossible - 27

Page 31: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VM interface - kernel agnostic

VMM

ld.lib.soVM interface (client)

init

coreVM interface (server)

VM session

kernel

kernel space

user space

entrypoint

vCPU0 ... vCPUn

Server: 200-400 LOCClient: NOVA, seL4: ~500 - Fiasco.OC: ~1000 - hw: ~30 LOC

Microkernel virtualization under one roof - dare the impossible - 28

Page 32: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on Genode’s -hw- and NOVA

VMMUTCB

kernel space

user space

NOVA microhypervisor

UTCBVMCS/VMCB

thread

vCPU

IPC call

IPC reply

VMMUTCB

vCPU state

kernel space

user space

Genode’s -hw- microkernel (ARM)

UTCB

vCPU state

thread

vCPU

signal

run

Microkernel virtualization under one roof - dare the impossible - 29

Page 33: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on Genode’s -hw- and NOVA

Event source(timer)

VMMkernel

VMvCPU

vCPU0 vCPU1Entrypoint hw/NOVA

VM exit

signal/IPC call

run/IPC replynon-blocking

VM resume

event (timeout)

pause/recallnon-blocking

VM exit

signal/IPC call

run/IPC replyinject vIRQ

Microkernel virtualization under one roof - dare the impossible - 30

Page 34: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on seL4 and Fiasco.OC

VMMIPCBuffer

kernel space

user space

seL4 microkernel

IPCBuffer

vCPU stateVMCS

thread

vCPU

syscall done

vmenter

(blocking)

VMMUTCB

vCPU state

kernel space

user space

Fiasco.OC microkernel

UTCB

vCPU stateVMCS/VMCB

thread

vCPU

syscall done

vmresume

(blocking)

Microkernel virtualization under one roof - dare the impossible - 31

Page 35: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on seL4 and Fiasco.OC

Event source(timer)

VMM kernel VM

vCPU0 vCPU1Entrypoint seL4/Fiasco.OC

vmenter/vmresumeblocking syscall

VM resume

Blocking syscall unfortunate → complicates life

Kernels provide mechanism to cancel

Avoid special case handling in Genode for first take→ Workaround: spawn per vCPU extra thread

Microkernel virtualization under one roof - dare the impossible - 32

Page 36: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on seL4 and Fiasco.OC

Event source(timer)

VMM kernel VM

vCPU0 vCPU1Entrypoint Handler0 Handler1

runrunnon-blocking

vmenter/vmresume

VM resume

runrunnon-blocking

vmenter/vmresume

VM resume

Microkernel virtualization under one roof - dare the impossible - 33

Page 37: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Control flow on seL4 and Fiasco.OC

Event source(timer)

VMM kernel VM

vCPU0 vCPU1Entrypoint Handler0 seL4/Fiasco.OC

runnon-blocking

vmenter/vmresumeblocking syscall

VM resume

event (timeout)

pausecancel vmenter/vmresume

vmenter/vmresumesyscall returns

signal

runinject vIRQ

vmenter/vmresumeinject vIRQ

VM resume

Microkernel virtualization under one roof - dare the impossible - 34

Page 38: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 35

Page 39: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 40: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 41: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 42: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 43: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 44: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VMM unit test

Control flow and exit handling on few instructionsMultiple vCPUs, multiple EPs, multiple physical CPUs

sel4 v9.0:Kernel fault on VMEnter by non vCPU thread → patch

No unrestricted guest support → patch

Scheduling bug if vCPU spins → starvation → patch

Kernel denies to boot on non VT-x platforms → patch

→ Working toy VMM on all 3 kernels→ no AMD support by seL4

Microkernel virtualization under one roof - dare the impossible - 36

Page 45: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM

Replaced all NOVA specific partsSimple Genode based guests for testing

Running again after few days on Genode/NOVA

Various debugging sessions on Fiasco.OC and seL4→ war stories (backup slides)→ 1 kernel patch for seL4 and 1 for Fiasco.OC

State: kernel agnostic Seoul VMM on all 3 kernelsGuests: Genode VMs, Linux VM+network+SMPseL4: kernel fault on Linux SMP VM → not investigated

Microkernel virtualization under one roof - dare the impossible - 37

Page 46: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM

Replaced all NOVA specific partsSimple Genode based guests for testing

Running again after few days on Genode/NOVA

Various debugging sessions on Fiasco.OC and seL4→ war stories (backup slides)→ 1 kernel patch for seL4 and 1 for Fiasco.OC

State: kernel agnostic Seoul VMM on all 3 kernelsGuests: Genode VMs, Linux VM+network+SMPseL4: kernel fault on Linux SMP VM → not investigated

Microkernel virtualization under one roof - dare the impossible - 37

Page 47: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM

Replaced all NOVA specific partsSimple Genode based guests for testing

Running again after few days on Genode/NOVA

Various debugging sessions on Fiasco.OC and seL4→ war stories (backup slides)→ 1 kernel patch for seL4 and 1 for Fiasco.OC

State: kernel agnostic Seoul VMM on all 3 kernelsGuests: Genode VMs, Linux VM+network+SMPseL4: kernel fault on Linux SMP VM → not investigated

Microkernel virtualization under one roof - dare the impossible - 37

Page 48: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

VBox 5 VMM - current state

Work in progress - current state:Kernel agnostic VBox5 binary ready and runnableNOVA: simple Genode VMs running againseL4/Fiasco.OC: VM gets up, fails/hangs early

Known remaining challenges:Guest FPU state access requiredI Missing in VM interfaceI Support by seL4 and Fiasco.OC unclear

seL4: no support for 64bit guests

Microkernel virtualization under one roof - dare the impossible - 38

Page 49: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Outline

1. Introduction

2. Kernel interfaces

3. VM interface harmonization

4. VMMs harmonized

5. Conclusion

Microkernel virtualization under one roof - dare the impossible - 39

Page 50: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Conclusion

Dare the impossible → possible*

Restrictions depending on the kernel

Roadmap:Finish VBox5 adaptationExtend -hw- kernel with VT-x extensionsOptional: support other platforms, e. g. ARM

Benefits:Portable VMMs across kernelsGenode users have the ultimate kernel choice

Microkernel virtualization under one roof - dare the impossible - 40

Page 51: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Thank you

Genode OS Frameworkhttps://genode.org

Source code at GitHubhttps://github.com/genodelabs/genode

Stories around Genodehttps://www.genodians.org

Genode Labs GmbHhttps://www.genode-labs.com

Microkernel virtualization under one roof - dare the impossible - 41

Page 52: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Backup

Microkernel virtualization under one roof - dare the impossible - 42

Page 53: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM - war stories I

Fiasco.OC:In-guest faults during protected→page mode transitionreason: EFER status of host taken instead of guestFiasco.OC: can be runtime configured → good

seL4:seL4: EFER register not saved on VMexit → kernel patch

Microkernel virtualization under one roof - dare the impossible - 43

Page 54: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM - war stories II

CR* shadow/mask handling required on seL4 & Fiasco.OCTook some time, caused frictionOpen issue:I Kernels overwrites some bits in CR* to adhere to hardware

requirementsI Overriden bits not known/announced to VMMI Read back CR* modifications contains changes of hypervisor

and VM mixedI Leads to various invalid guest states

I Heuristics required - unexpected but manageable:I Job of Fiasco.OC/seL4 vs VMM ?

Microkernel virtualization under one roof - dare the impossible - 44

Page 55: Microkernel virtualization under one roof - dare the ......UTCB VMM kernelspace userspace NOVAmicrohypervisor UTCB VMCS/VMCB thread vCPU IPCcall IPCreply UTCB VMM vCPUstate kernelspace

Seoul VMM - war stories III

Another test VM:seL4 and NOVA: worked fineFiasco.OC: invalid guest state

Long long sessions of VM state diffs between kernelsHappens on switch from protected → real mode

Source reason:vIRQ injection can not be reset by VMM on Fiasco.OCPatching kernel helps

Microkernel virtualization under one roof - dare the impossible - 45