OS Virtualization.

Slides:



Advertisements
Similar presentations
Virtualization Dr. Michael L. Collard
Advertisements

Virtualization Technology
Virtualisation From the Bottom Up From storage to application.
E Virtual Machines Lecture 3 Memory Virtualization
Bart Miller. Outline Definition and goals Paravirtualization System Architecture The Virtual Machine Interface Memory Management CPU Device I/O Network,
Xen and the Art of Virtualization A paper from the University of Cambridge, presented by Charlie Schluting For CS533 at Portland State University.
Network Implementation for Xen and KVM Class project for E : Network System Design and Implantation 12 Apr 2010 Kangkook Jee (kj2181)
1 Disco: Running Commodity Operating Systems on Scalable Multiprocessors Edouard Bugnion, Scott Devine, and Mendel Rosenblum, Stanford University, 1997.
Virtualization and the Cloud
Virtual Machines. Virtualization Virtualization deals with “extending or replacing an existing interface so as to mimic the behavior of another system”
Virtualization for Cloud Computing
LINUX Virtualization Running other code under LINUX.
CSE 451: Operating Systems Winter 2012 Module 18 Virtual Machines Mark Zbikowski and Gary Kimura.
Virtualization-optimized architectures
Tanenbaum 8.3 See references
Zen and the Art of Virtualization Paul Barham, et al. University of Cambridge, Microsoft Research Cambridge Published by ACM SOSP’03 Presented by Tina.
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
Virtualization Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is licensed.
Virtual Machine and its Role in Distributed Systems.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Our work on virtualization Chen Haogang, Wang Xiaolin {hchen, Institute of Network and Information Systems School of Electrical Engineering.
CS533 Concepts of Operating Systems Jonathan Walpole.
System Virtualization 1 Learning Objective: –To understand the implementation choices and details of System Virtualization COMP
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
Cloud Operating System Unit 09 Cloud OS Core Technology M. C. Chiang Department of Computer Science and Engineering National Sun Yat-sen University Kaohsiung,
Introduction to virtualization
Full and Para Virtualization
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Cloud Computing – UNIT - II. VIRTUALIZATION Virtualization Hiding the reality The mantra of smart computing is to intelligently hide the reality Binary->
Virtualization Neependra Khare
1 Virtualization "Virtualization software makes it possible to run multiple operating systems and multiple applications on the same server at the same.
CS 695 Topics in Virtualization and Cloud Computing, Autumn 2012 CS 695 Topics in Virtualization and Cloud Computing More Introduction + Processor Virtualization.
Virtualization-optimized architectures
Lecture 13: Virtual Machines
Operating Systems, 2016, Meni Adler, Danny Hendler & Amnon Meisels
Translation Lookaside Buffer
Virtualization for Cloud Computing
Introduction to Virtualization
Virtualization.
Virtualization Technology
L2- Virtualization Technology
Presented by Mike Marty
Virtualization Dr. Michael L. Collard
Lecture 24 Virtual Machine Monitors
Virtualization overview
Virtual Machines Calum Aldridge.
Virtual Servers.
Disco: Running Commodity Operating Systems on Scalable Multiprocessors
CSE 153 Design of Operating Systems Winter 2018
Running other code under LINUX
OS Virtualization.
Virtualization Layer Virtual Hardware Virtual Networking
Virtualization Techniques
A Survey on Virtualization Technologies
Chapter 33: Virtual Machines
Virtual machines benefits
Computer Security: Art and Science, 2nd Edition
Full and Para Virtualization
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CSE 153 Design of Operating Systems Winter 2019
Virtualization Dr. S. R. Ahmed.
Xen and the Art of Virtualization
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Hardware Virtualization
CS295: Modern Systems Virtualization
Slides from E0-253 taught by Arkaprava Basu and Vinod Ganapathy
Chapter 33: Virtual Machines
Hypervisor A hypervisor or virtual machine monitor (VMM) is computer software, firmware or hardware that creates and runs virtual machines. A computer.
Presentation transcript:

OS Virtualization

Outline Background What is Virtualization? Why would we want it? Why is it hard? How do we do it? Choices

What is Virtualization? 11/23/2018 What is Virtualization? OS virtualization Create a platform that emulates a hardware platform and allows multiple instances of an OS to use that platform, as though they have full and exclusive access to the underlying hardware cs431-cotter

What is Virtualization? Applications Applications Applications Applications OS 1 OS 2 OS 3 OS 4 Virtualization Platform Hardware

The Problem OS uses kernel mode / user mode to protect the OS. System calls (privileged instructions) generate a trap (software interrupt) that forces a switch to kernel mode Assembly sensitive instructions (I/O, MMU control, etc.) that must only be executed by the kernel

The Problem If our VM now runs in user space, we cannot run sensitive instructions in it, since those must trap to kernel space. We would like such instructions to force a trap into the hypervisor Hypervisor responsible to assist with sensitive instructions

The Problem Hardware protection rings Supervisor mode Can run any instruction (ring 0). Trusted to not fail, in case of failure the system crashes. User programs use ring 3 Hypervisor runs on ring 0, guest OS does not

The Problem On x86, some instructions are sensitive but not privileged 11/23/2018 The Problem On x86, some instructions are sensitive but not privileged Example: POPF Pops data from stack to the EFLAGS register Can be called from all protection rings, behaves differently when not in ring 0 Interrupt flag is part of EFLAGS, only changes on ring 0 Is not privileged (does not trap) Note that in rings 1-3 IF flag does not change cs431-cotter

Solution – binary translation 11/23/2018 Solution – binary translation Replace problematic calls dynamically Read in code, looking for basic blocks Then inspect basic block to find problematic instructions. If found, replace with VM call (process called binary translation) Then, cache block and execute. Eventually, most basic blocks will be modified and cached, and will run at near native speed. Can force traps on sensitive non-privileged instructions Note that in rings 1-3 IF flag does not change cs431-cotter

Solution – VM hardware Systems with intel VT-x or AMD SVM (since 2005) 11/23/2018 Solution – VM hardware Systems with intel VT-x or AMD SVM (since 2005) New assembly commands to enter VM mode Hypervisor runs on ring 0 under root mode Guest OS runs in ring 0 under non-root mode Changes are done within VM specific state called VMCS (Virtual Machine Control Structure) Even with VM hardware support binary translation can still be used to improve performance Note that in rings 1-3 IF flag does not change cs431-cotter

Implementation Type 1 Hypervisor Type 2 Hypervisor Paravirtualization

Type 1 Hypervisor Runs on “bare metal” Hypervisor is the machine’s kernel Made for servers, includes interface for remote / admin access Examples: Xen, Vmware vSphare, etc.

Type 2 Hypervisor Runs from within a OS. Supports guest OSs above it. 11/23/2018 Type 2 Hypervisor Runs from within a OS. Supports guest OSs above it. VM software must include kernel module Example: Oracle VirtualBox, VMware Player, etc. cs431-cotter

Paravirtualization Modify Guest OS so that all calls to non-privileged sensitive instructions are changed to hypervisor calls. Much easier (and more efficient) to modify source code than to emulate hardware instructions (as in binary translation).

Problems with Paravirtualization Paravirtualized systems won’t run on native hardware There are many different paravirtualization systems that use different commands, etc. VMware, Xen, etc. Proposed solution: Modify the OS kernel so that it calls a special set of procedures to execute sensitive instructions (Virtual Machine Interface ) Bare metal – link to library that implement code On VM – link to VM specific library

Memory Virtualization OS tracks mapping of virtual memory pages to physical memory page frames. Builds page tables, then updates paging register (trap). Allow hypervisor to manage page mapping, and use shadow page tables for the VMs

Shadow Page Table Guest page tables map: Guest VA Guest PA Shadow tables: Guest VA Host PA.

Nested/extended page tables Requires hardware support Two “CR3”s (CR3 and EPTP) MMU translates each guest mapping level Guest OS Hypervisor Page table VMM SW Host page table Page dir. TLB CPU CR3 EPTP HW

Nested page tables Guest page table map: Guest VA  Guest PA Nested page table map: Guest PA  Host PA

I/O Virtualization Each guest OS holds its own “partition”. Typically implemented as a file or region on disk Hypervisor must convert guest OS address (block #) into physical address in region May convert between storage types. Must deal with DMA (Direct memory access) requests

Question (Moed B 2017) במערכת וירטואלית ישנו hypervisor התומך בshadow page tables. תאר בקצרה תהליך חיפוש כתובת וירטואלית במערכת מה היתרון של מערכת כזו על פני מערכת המשתמשת ב brute force?

Question (Moed B 2017) Guest OS Hypervisor TLB CPU HW G-CR3 CR3 Page table VMM SW Shadow page table Page dir. Interrupt & VMM corrects page table. G-CR3 TLB CPU CR3 HW

Question (Moed B 2017) במערכת כזו ישנו רגיסטר בCPU המצביע על הShadow page table. בהינתן כתובת וירטואלית של לקוח במערכת כזו ישנן 2 אופציות: טבלאות הshadow ממפות את הכתובת והתהליך זהה למערכת רגילה הטבלאות shadow אינן ממפות את הכתובת, יתקבל interrupt מסוג page fault שיעביר אותנו לקוד בhypervisor אשר יבדוק האם הכתובת ממופה בטבלאות הלקוח (ע"י משתנה שישמור את כתובת הטבלה הראשית של הלקוח), אם הכתובת לא ממופה נחזיר page fault ללקוח, אחרת נמפה את הדף בטבלאות הshadow כדי שימפה ישירות לזכרון המערכת ונחזור למערכת האורחת (כעת חזרנו למקרה (1)

Question (Moed B 2017) Guest OS Hypervisor TLB CPU HW CR3 Define these pages as not R/W Guest OS Hypervisor Page table VMM SW VM memory layout Page dir. TLB CPU CR3 HW

Question (Moed B 2017) במערכת המבצעת גישות brute force סימנו את כל דפי המיפוי כnon read non write ולכן על כל גישה יתקבל interrupt. במערכת מסוג shadow page table נקבל interrupt רק על הגישה הראשונה לדף כלשהו, מהרגע שמיפינו אותו המערכת האורחת יכולה להמשיך לעבוד כרגיל