97
1 MINIX3: A Reliable and Secure Operating System Andrew S. Tanenbaum and a team of students and programmers who actually did all the work Vrije Universiteit Amsterdam, The Netherlands

MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

Embed Size (px)

Citation preview

Page 1: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

1

MINIX3: A Reliable and SecureOperating System

Andrew S. Tanenbaum

and a team of students and programmers who actually did all the work

Vrije UniversiteitAmsterdam, The Netherlands

Page 2: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

2

GOAL OF OUR WORK: BUILD A RELIABLE OS

Tanenbaum’s definition of a reliable OS:

“An operating system is said to be reliable when a typical user has never experienced even a single failure in his or her lifetime and does not know anybody who has ever experienced a failure.”

In engineering terms, this is probably mean time to failure > 50 years

I don’t think we are there yet

Page 3: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

3

THE TELEVISION MODEL

1. You buy the television2. You plug it in3. It works perfectly for the next 10 years

Page 4: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

4

THE COMPUTER MODEL (WINDOWS EDITION)

1. You buy the computer 2. You plug it in 3. You install service packs 1 through 9f 4. You install 18 new emergency security patches 5. You find and install 7 new device drivers 6. You install antivirus software 7. You install antispyware software 8. You install antihacker software (firewall) 9. You install antispam software10. You reboot the computer

Page 5: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

5

THE COMPUTER MODEL (2)

11. It doesn’t work12. You call the helpdesk13. You wait on hold for 30 minutes14. They tell you to reinstall Windows

Page 6: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

6

TYPICAL USER REACTION

The New York Times recently reported that 25% of computer users have gotten so angry at their computerthat they physically hit it.

Page 7: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

IS RELIABILITY SO IMPORTANT?

•  Annoying•  Lost work•  But also think about

–  Industrial control systems in factories–  Power grids–  Hospital operating rooms–  Banking and e-commerce servers–  Emergency phone centers–  Control software in cars, airplanes, etc.

7

Page 8: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

IS THIS FEASIBLE?

•  We won’t find out if we don’t try•  Dutch Royal Academy gave me €2 million to try•  European Union gave me €2.5 million to give it a shot•  So, we’re trying

8

Page 9: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

9

IS RELIABILITY ACHIEVABLE AT ALL?

•  Systems can survive hardware failures!–  RAIDs can survive failed disks–  ECC memory can survive parity errors in memory–  TCP/IP can survive lost packets–  CD-ROM drives can correct many simultaneous errors

•  We need to be able to survive software failures, too

Page 10: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

10

A NEED TO RETHINK OPERATING SYSTEMS

•  Operating systems research need to be refocused–  We have nearly infinite hardware on PC-class machines–  Plenty of CPU cycles, RAM, bandwidth–  Current software has tons of (useless) features–  Consequently, the software is slow, bloated, and buggy

•  To achieve the TV model, future OSes, must be–  Small–  Simple–  Modular–  Reliable–  Secure–  Self-healing

Page 11: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

BRIEF HISTORY OF OUR WORK

•  (1976) John Lions wrote a book on UNIX V6•  (1979) AT&T released V7 and forbade books on it L•  (1985) I started to write a UNIX-like OS from scratch•  (1987) MINIX 1 + book for teaching OS classes released•  (1997) MINIX 2 (POSIX) & 2nd edition of book released•  (2000) MINIX 2 license changed to BSD•  (2004) MINIX 3: start of work making a reliable OS•  (2006) 3rd edition of book•  (2008) European grant•  (2010) Focus moved towards embedded systems•  (2013) MINIX 3.3.0 moves to NetBSD “compatibility”

11

Page 12: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

THREE EDITIONS OF THE BOOK

12

1 2 3

Page 13: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

13

INTELLIGENT DESIGN

•  Microkernel (15,000 LoC vs. > 15 million for Linux)–  Bugs per 1000 LoC: Most S/W (1-10)–  MINIX 3 at least 15 kernel bugs; Linux has > 15,000–  Drivers have 3-7x more bugs than rest of kernel–  About 70% of the code is drivers

•  Highly modular•  OS runs as multiple user-mode server processes

AS APPLIED TO OPERATING SYSTEMS

Page 14: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

14

STEP 1: ISOLATE COMPONENTS

•  Move all loadable modules out of the kernel–  includes all device drivers and file systems

•  Run each module as a separate process with POLA (Principle Of Least Authority)

Page 15: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

15

STEP 2: ISOLATE I/O

•  Isolate I/O devices•  Limit access to I/O ports•  Constrain DMA (needs hardware assistance)

Page 16: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

16

STEP 3: ISOLATE COMMUNICATION

•  Limit interprocess communication•  Restrict kernel calls on a per component basis•  Restrict IPC on a ‘need-to-communicate’ basis•  Make sure faulty receiver cannot hang sender

Page 17: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

17

ARCHITECTURE OF MINIX 3

Shell Make User...

FS 1 FS 2 Proc. Other... ServersUsermode

Disk TTY Net Print Other... Drivers

Process

Microkernel handles interrupts, processes, scheduling, IPC

Kernelmode

Page 18: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

18

USER-MODE DEVICE DRIVERS

•  Each driver runs as a user-mode process•  No superuser privileges•  Protected by the MMU•  Do not have access to I/O ports, privileged instrs

Page 19: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

19

USER-MODE SERVERS

•  Each server runs as a separate process•  Some key servers

–  Virtual file server–  Actual file servers–  Process manager–  Memory manager–  Network server–  Reincarnation server

Page 20: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

20

Usermode Servers

Drivers

Users

Kernel

A SIMPLIFIED EXAMPLE: DOING A READ

File access when the block is in the FS cache

1

2 3

4

User

Disk

FSFS

Page 21: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

21

ServersUsermode

Drivers

Users

Kernel

FILE SERVER (2)

1

2

3

9

4

67,8

File access when the block is NOT in the FS cache

5

Notification

FS

User

Disk

Page 22: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

22

REINCARNATION SERVER

•  Parent of all the drivers and servers•  When a driver or server dies, RS collects it•  RS checks a table for action to take e.g., restart it•  RS also pings drivers and servers frequently

Page 23: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

23

DISK DRIVER RECOVERY

ServersUsermode

Drivers

Users

Kernel

User1

FS2

DiskdriverX 3. Crash!New

driver

4

RSRS

5

System is self healing—this is how we hope to make it reliable

Page 24: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

24

KERNEL RELIABILITY/SECURITY

•  Fewer LoC means fewer kernel bugs•  Small kernel (15,000 LoC) means reduced TCB •  NO foreign code (e.g., drivers) in the kernel•  Static data structures (no malloc in kernel)•  Moving bugs to user space reduces their power

Page 25: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

25

IPC RELIABILITY/SECURITY

•  Fixed-length messages (no buffer overruns)•  Rendezvous system was simple

–  No lost messages–  No buffer management–  We had to add asynchronous messages

•  Interrupts and messages are unified

Page 26: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

26

DRIVER RELIABILITY/SECURITY

•  Untrusted code: heavily isolated•  Bugs, viruses cannot spread to other modules•  Cannot touch kernel data structures•  Bad pointers crash only one driver; recoverable•  Infinite loops detected and driver restarted•  Restricted power to do damage (not superuser)

Page 27: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

27

OTHER ADVANTAGES OF USER DRIVERS

•  Short development cycle•  Normal programming model•  No down time for crash and reboot•  Easy debugging•  Good flexibility

Page 28: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

28

FAULT INJECTION EXPERIMENT

•  We injected 800,000 faults into each of 3 drivers•  Done on the binary drivers•  Examples, change src addr, dest addr, loop condition•  100 faults were injected on each experiment•  Waited 1 sec to see if the driver crashed•  If no crash, inject another 100 faults and repeat•  The driver crashed in 18,038 trials•  The operating system NEVER crashed

Page 29: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

29

PORT OF MINIX 3 TO ARM

•  Restructured source tree for multiple architectures•  Changed booting to support uboot for ARM•  Rewrote the low-level code dealing with hardware•  Changed code for context switching, paging, etc.•  Removed x86 segmentation code•  Imported NetBSD ARM headers and libraries•  Ported build.sh for cross-toolchain support•  Wrote drivers for SD card and other Beagle devices

Page 30: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

30

EMBEDDED SYSTEMS

9 cm

5 cm

BeagleBone Black

Page 31: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

31

CHARACTERISTICSItem Beaglebone Black

Page 32: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

32

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7

Page 33: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

33

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHz

Page 34: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

34

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MB

Page 35: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

35

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GB

Page 36: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

36

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080p

Page 37: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

37

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92

Page 38: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

38

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 Mbps

Page 39: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

39

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1

Page 40: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

40

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source Yes

Page 41: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

41

CHARACTERISTICSItem Beaglebone Black

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 42: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

42

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 43: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

43

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 44: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

44

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 45: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

45

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GBVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 46: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

46

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 47: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

47

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 48: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

48

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92 40Ethernet 10/100 MbpsUSB 1Open source YesPrice (quantity 1) $45

Page 49: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

49

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92 40Ethernet 10/100 Mbps 10/100 MbpsUSB 1 Open source YesPrice (quantity 1) $45

Page 50: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

50

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92 40Ethernet 10/100 Mbps 10/100 MbpsUSB 1 4Open source YesPrice (quantity 1) $45

Page 51: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

51

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92 40Ethernet 10/100 Mbps 10/100 MbpsUSB 1 4Open source Yes NoPrice (quantity 1) $45

Page 52: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

52

CHARACTERISTICSItem Beaglebone Black Raspberry Pi B+

CPU ARM v7 ARM v6Clock 1 GHz 700 MHzRAM 512 MB 512 MBFlash 4 GB NoneVideo HDMI/1080p HDMI/1080pGPIO pins 92 40Ethernet 10/100 Mbps 10/100 MbpsUSB 1 4Open source Yes NoPrice (quantity 1) $45 $35

Page 53: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

I ADMIT I WAS WRONG

•  On 29 Jan 1992 I posted to comp.os.minix this:

•  “Don`t get me wrong, I am not unhappy with LINUX. It will get all the people who want to turn MINIX in BSD UNIX off my back.”

•  I Apologize. Now I do want to turn MINIX into BSD. It just took me 20 years to realize this.

53

Page 54: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

MINIX 3 MEETS BSD

54

+ =

BSD Daemon is copyright 1988 by Marshall Kirk McKusick and is used with permission.

Page 55: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

OR MAYBE

55

Page 56: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

WHY BSD?

•  MINIX 3 didn’t have enough application software•  BSD is a proven, portable, quality product•  BSD has better code quality than Linux•  Pkgsrc handles packages better than what we had•  Thousands of excellent packages available•  Active community•  License compatibility•  Why NetBSD?•  Mostly due to its emphasis on portability

56

Page 57: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

NETBSD FEATURES IN MINIX 3.3.0

•  Clang/LLVM compiler•  NetBSD build system•  ELF file format•  Source code tree modeled on NetBSD•  Headers and libraries are from NetBSD•  X11•  Pkgsrc works and builds 5040 NetBSD packages•  Nevertheless, it is built on MINIX 3 kernel & servers

57

Page 58: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

NETBSD FEATURES MISSING IN MINIX 3.3.0

•  Kernel threads (we do have userland pthreads)•  Some system calls:

–  All _LWP*, MSG*, SEM* calls–  CLONE–  Some GET, IOCTL calls–  KQUEUE, KTRACE–  VFORK–  Job control–  Some other minor calls

•  Nevertheless, we can build over 5000 packages

58

Page 59: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

KYUA TESTS

59

Conclusion: 2139 out of 2651 passed (81%)

Page 60: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

60

SYSTEM ARCHITECTURE

Servers

Drivers

Microkernel (this is the only part running in kernel mode)

Net

VFS

TTYDisk USB …

FS MM Reincarnat

Clang Pkgsrc (libc)

…Pkg 1 Pkg nUsers

OS(MINIX)

User- Land(NetBSD)

Page 61: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

MINIX 3 ON THE THREE BEAGLE BOARDS

61

Page 62: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

YOUR ROLE

•  MINIX 3 is an open-source project•  I hope some of you will join and help us•  Things to do

–  Add crucial missing system calls–  Port more packages (Java, a browser, etc.)–  Write the missing drivers for Beagle series–  Get it running on Raspberry Pi & other platforms–  Port Rump–  Port required libraries and then port a GUI

62

Page 63: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

63

MINIX 3 IN A NUTSHELL

•  Microkernel reimplementation of NetBSD•  Fully open source with BSD license•  Highly compatible with NetBSD•  Supports both LLVM and gcc•  Uses NetBSD pkgsrc•  Over 5000 packages build•  Go get it at www.minix3.org and try it

Page 64: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

64

POSITIONING OF MINIX

•  Show that multiserver systems are reliable•  Demonstrate that drivers belong in user mode•  High-reliability and fault-tolerant applications•  $50 single-chip, small-RAM laptops for 3rd world•  Embedded systems

Page 65: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

FUTURE FEATURE: LIVE UPDATE

•  Software is updated to:–  Fix bugs–  Improve performance–  Add new features

•  Goal is to update OS to a new version w/o reboot•  Running processes must NOT be restarted•  New version of OS may have new data structures•  Lots of state in there: open files, timers,etc.

65

Page 66: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

EXAMPLE OF HOW WOULD THIS WORK

66

A Apache still running

FreeBSD 10.2

•  Replace the OS while user processes are running•  Very difficult to do with BSD, Linux, Windows, etc.

Apache running

FreeBSD 10.1

A

Kernel

User

Page 67: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

LIVE UPDATE IN MINIX

67

Apache runningA

FS 6.0

MM Dri-ver

Kernel

User

User

Microkernel

A

FS 7.0

MM Dri-ver

Apache still running

Microkernel

Page 68: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW DO WE DO THE UPDATE?

•  Manager tells some process (e.g. Old-FS) to get ready•  Old-FS finishes its work and queues new work•  Manager creates New-FS process with new code•  LLVM puts tables inside New-FS listing its data objects•  New-FS contacts Old-FS and asks for state it needs•  The state is transferred one object at a time•  When all state is transferred, Third-FS is created•  It talks to New-FS and tries to recreate Old-FS•  If they agree New-FS becomes FS, else revert to Old-FS•  Like translating English to Dutch, then Dutch to English

68

Page 69: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

69

A

FS 6.0

Apache running

Microkernel

Old FS

Page 70: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

70

A

FS 6.0

Apache running

Microkernel

Getready

Page 71: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

71

A

FS 6.0

Apache running

Microkernel

FS 7.0

Page 72: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

72

A

GFS 6.0

Apache running

Microkernel

FS 7.0

I need variable x

Page 73: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

73

A

FS 6.0

Apache running

Microkernel

FS 7.0

Here is variable x

Page 74: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

74

A

FS 6.0

Apache running

Microkernel

FS 7.0

FS ?

Page 75: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

75

A

FS 6.0

Apache running

Microkernel

FS 7.0

FS ?

I need variable x

Page 76: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

76

A

FS 6.0

Apache running

Microkernel

FS 7.0

FS ?

Here is variable x

Page 77: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

77

Are these the same?

A

FS 6.0

Apache running

Microkernel

FS 7.0

FS ?

Page 78: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

HOW THE UPDATE WORKS

78

A Apache running

Microkernel

FS 7.0

Page 79: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

79

MUCH BETTER THAN KSPLICE

•  KSPLICE can handle only small security patches•  KSPLICE patches the running process•  Over time, crud accumulates in the process•  If the update fails, there is no recovery

Page 80: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

OTHER USES OF LIVE UPDATE

•  Enhanced security: –  Update the OS at a high rate to foil return-to-libc attacks–  Stop any attack that uses knowledge of memory layout–  Reduce exposure to information leakage attacks

•  Garbage collection in C (!)–  Only live data is copied over to the new version–  This can “fix” memory leaks (malloc but no free)

80

Page 81: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

81

RESEARCH: FAULT INJECTION

Inject fault?

Originalunmodifiedbasic block

Basic blockwith faultinjected

This structure is created automatically by the LLVM compiler

Page 82: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

82

NEW PROGRAM STRUCTURE

This can be optimizedby patching the originalbinary to get any test without recompilation Overhead is 8%

Page 83: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

83

MINIX 3 LOGO

•  Why a raccoon?–  Small–  Cute–  Clever–  Agile–  Eats bugs–  More likely to visit your house than a penguin

Page 84: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

84

WEBSITE: www.minix3.org

Page 85: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

DOCUMENTATION IS IN A WIKI

•  Wiki.minix3.org•  You can help document the system

85

Page 86: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

86

TRAFFIC TO WWW.MINIX3.ORG

Total visits to the main page since 2004: 3.1 million

Actual downloads since 2007: 650,000 (from the log)

Page 87: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

87

MINIX 3 GOOGLE NEWSGROUP

Page 88: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

88

CONCLUSION

•  Current OSes are bloated and unreliable•  MINIX 3 is an attempt at a reliable, secure OS•  Kernel is very small (15,000 LoC)•  OS runs as a collection of user processes•  Each driver is a separate process•  Each OS component has restricted privileges•  Faulty drivers can be replaced automatically•  Live update is possible (not in current release)

Page 89: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

89

SURVEY

•  Please download MINIX 3 from www.minix3.org•  Give it a try•  Fill out the survey on the main page•  We have had 650,000 downloads but we don’t

know who they are or what they are doing•  We are trying to build a community

Page 90: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

90

THE END

Page 91: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

91

WEBSITE: www.minix3.org

Page 92: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

92

Page 93: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

93

MASTERS DEGREE AT THE VU

•  If you are interested in computer systems•  Look at our masters in parallel & distributed syst.•  Google me•  Look at my home page•  See video linked there or check out

pdcs.vu.nl

Page 94: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

94

DISK PERFORMANCE

Page 95: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

95

THE COST OF DRIVER RECOVERY•  We killed the Ethernet driver every Δt sec to

simulate repeated driver crashes

Driver recovery takes about 360 msec

Page 96: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

96

RESEARCH: MULTICORE CHIPS

•  Network stack has components•  Chips may be heterogeneous•  Where to put each component?•  Experiments scaling frequencies•  Sometimes slower is faster!•  Sleep/wakeup is expensive

TCP IP

Ether Kernel

Multicore chip

Core

Page 97: MINIX3: A Reliable and Secure Operating System - Haxpohaxpo.nl/materials/haxpo2015ams/HAXPO HIGHLIGHT - Andrew Tanenbaum... · 1 MINIX3: A Reliable and Secure Operating System Andrew

97

RESEARCH: NEW FILE SYSTEM--LORIS

•  Better reliabilty•  Better flexibility•  Handles heterogeneity better•  File rather than block oriented•  Uses checksums to detect corruption

VFS

Naming

Cache

Logical

Physical

Driver

Introduces concept of a logical file (1 or more phys files spread or striped over possiblyheterogeneous devices)