Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor?



Similar documents
Full and Para Virtualization

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

Intel Virtualization Technology Overview Yu Ke

Chapter 5 Cloud Resource Virtualization

Nested Virtualization

Virtualization. ! Physical Hardware. ! Software. ! Isolation. ! Software Abstraction. ! Encapsulation. ! Virtualization Layer. !

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Virtualization. Pradipta De

Virtualization. Jia Rao Assistant Professor in CS

Virtualization Technology. Zhiming Shen

Hybrid Virtualization The Next Generation of XenLinux

COS 318: Operating Systems. Virtual Machine Monitors

Virtual Machines. COMP 3361: Operating Systems I Winter

Virtual machines and operating systems

Clouds, Virtualization and Security or Look Out Below

VMware and CPU Virtualization Technology. Jack Lo Sr. Director, R&D

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

A Hypervisor IPS based on Hardware assisted Virtualization Technology

Cloud^H^H^H^H^H Virtualization Technology. Andrew Jones May 2011

Virtualization. Types of Interfaces

Knut Omang Ifi/Oracle 19 Oct, 2015

Basics in Energy Information (& Communication) Systems Virtualization / Virtual Machines

Cloud Computing CS

Windows Server Virtualization & The Windows Hypervisor

Hypervisors and Virtual Machines

Virtualization in Linux KVM + QEMU

matasano Hardware Virtualization Rootkits Dino A. Dai Zovi

Virtual Machine Monitors. Dr. Marc E. Fiuczynski Research Scholar Princeton University

Jukka Ylitalo Tik TKK, April 24, 2006

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

Virtualization VMware Inc. All rights reserved

Attacking Hypervisors via Firmware and Hardware

Intel Virtualization Technology Processor Virtualization Extensions and Intel Trusted execution Technology

Understanding Full Virtualization, Paravirtualization, and Hardware Assist. Introduction...1 Overview of x86 Virtualization...2 CPU Virtualization...

Attacking Hypervisors via Firmware and Hardware

Virtual Machine Security

Virtualization. Jukka K. Nurminen

Enabling Intel Virtualization Technology Features and Benefits

Introduction to Virtual Machines

CS 695 Topics in Virtualization and Cloud Computing. More Introduction + Processor Virtualization

Basics of Virtualisation

Hypervisors. Introduction. Introduction. Introduction. Introduction. Introduction. Credits:

Chapter 16: Virtual Machines. Operating System Concepts 9 th Edition

Compromise-as-a-Service

Brian Walters VMware Virtual Platform. Linux J. 1999, 63es, Article 6 (July 1999).

The NOVA Microhypervisor

Virtualization Technologies

BHyVe. BSD Hypervisor. Neel Natu Peter Grehan

Performance tuning Xen

x86 Virtualization Hardware Support Pla$orm Virtualiza.on

Virtualization. Dr. Yingwu Zhu

Intel Virtualization Technology and Extensions

Hardware virtualization technology and its security

Xen and the Art of Virtualization

The Xen of Virtualization

KVM: A Hypervisor for All Seasons. Avi Kivity avi@qumranet.com

OPEN SOURCE VIRTUALIZATION TRENDS. SYAMSUL ANUAR ABD NASIR Warix Technologies / Fedora Community Malaysia

Virtual Machines. Virtualization

IOS110. Virtualization 5/27/2014 1

Machine Virtualization: Efficient Hypervisors, Stealthy Malware

Kernel Virtual Machine

Xen and the Art of. Virtualization. Ian Pratt

EE282 Lecture 11 Virtualization & Datacenter Introduction

Distributed Systems. Virtualization. Paul Krzyzanowski

Development of Type-2 Hypervisor for MIPS64 Based Systems

Enabling Technologies for Distributed Computing

RPM Brotherhood: KVM VIRTUALIZATION TECHNOLOGY

AES Flow Interception : Key Snooping Method on Virtual Machine. - Exception Handling Attack for AES-NI -

kvm: Kernel-based Virtual Machine for Linux

COS 318: Operating Systems. Virtual Machine Monitors

Survey On Hypervisors

Virtualization for Cloud Computing

Practical Protection of Kernel Integrity for Commodity OS from Untrusted Extensions

Cloud Architecture and Virtualisation. Lecture 4 Virtualisation

OS Virtualization. CSC 456 Final Presentation Brandon D. Shroyer

KVM Security Comparison

Nested Virtualization

Virtualization. Explain how today s virtualization movement is actually a reinvention

FRONT FLYLEAF PAGE. This page has been intentionally left blank

Leveraging Thin Hypervisors for Security on Embedded Systems

Bluepilling the Xen Hypervisor

CPET 581 Cloud Computing: Technologies and Enterprise IT Strategies. Virtualization of Clusters and Data Centers

OSes. Arvind Seshadri Mark Luk Ning Qu Adrian Perrig SOSP2007. CyLab of CMU. SecVisor: A Tiny Hypervisor to Provide

Enabling Technologies for Distributed and Cloud Computing

Intel Virtualization Technology (VT) in Converged Application Platforms

Cloud Computing. Dipl.-Wirt.-Inform. Robert Neumann

Windows Server Virtualization & The Windows Hypervisor. Background and Architecture Reference

COS 318: Operating Systems

x86 ISA Modifications to support Virtual Machines

Virtualization Technology. Zhonghong Ou Data Communications Software Lab, Aalto University

Security Challenges in Virtualized Environments

KVM KERNEL BASED VIRTUAL MACHINE

Using Linux as Hypervisor with KVM

Virtualization benefits Introduction to XenSource How Xen is changing virtualization The Xen hypervisor architecture Xen paravirtualization

Taming Hosted Hypervisors with (Mostly) Deprivileged Execution

VMkit A lightweight hypervisor library for Barrelfish

Privacy Protection in Virtualized Multi-tenant Cloud: Software and Hardware Approaches

Virtual Machines. Virtual Machine (VM) Examples of Virtual Systems. Types of Virtual Machine

Hypervisor Memory Forensics

Nested Virtualization

Transcription:

Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor? Mr. Jacob Torrey February 26, 2014 Dartmouth College 153 Brooks Road, Rome, NY 315.336.3306 http://ainfosec.com @JacobTorrey torreyj@ainfosec.com Linkedin.com/in/jacobtorrey 1

Introduction } In efforts to ease system consolidation and optimize resource use, Intel (and ARM, AMD ) have provided hardware extensions to support virtualization of disparate OSes on a single physical machine } This lecture aims to provide a short introduction to these extensions and how to utilize them in future research (there is a lot of emergent/weird machine behavior here) } Slides will be provided for reference, please don t hesitate to jump in with questions at any time 2

Full vs. Paravirtualization } In this talk, focus will mostly be on full virtualization Guest OS is unmodified, generally thinks it is running without VMM } Paravirtualization is where modifications to the guest OS are made to simplify For example: disk driver talks to VMM directly, rather than trapping on MMIO/PIO requests PV drivers still used on fully virtualized VMMs for speed and management advantages } Intel VT-x enables full virtualization From architecture side, more interesting (to me at least) 3

Outline } } } } } } Gap Analysis From OS to VMM Technical Overviews General architecture Memory management/isolation VMCS mechanics Exit conditions Asides: TXT & SMM Interesting Research Recovering private keys from VM side-channels MoRE VT-x + TLB splitting NoHype Virtualization sans VMM Possible Future Work Ideas Distributed NUMA SSI ELFbac model for VMM introspection Concluding Remarks Questions 4

Gap Analysis Ring 0 to Ring -1 } In short, a virtual machine monitor (VMM aka hypervisor) is a kernel where OSes are applications Can abstract memory (guest physical addresses to machine physical) Multiplex between OSes and trap on specified exceptions/ violations Provide a consistent & abstracted view of hardware } Well-designed architecture (mostly) cleans a lot of cruft needed for legacy support Originally no support for real-mode 64-bit aware, no PAE needed Allows VMM to be very small code base 5

VT-x in a Figure } Shows VMM slot, and the process for transitioning to and from from multiple guests } From Intel SDM 3C Official VT-x specification document 6

Technical Overview General Architecture } Separated into VMX root and non-root mode VMXON, VMXOFF and VM Exits/Enters switch between two modes Can be initiated from either Ring 0 or SMM ( Ring -2 ) } VMM sets up task_struct-like VM control structure (VMCS) for each VM Specifies what events will trigger VM Exit } Some events always trigger VM Exit CPUID, RDTSC, etc Can be used to determine if a OS is being maliciously virtualized 7

Technical Overview General Architecture II } VMM is protected from rogue guests, and guests benefit from some protections from each other Performance and cost were driving factors in implementation } Couples with other Intel technologies for greater assurances VT-d: Prevents hardware devices from DMAing memory to arbitrary memory TXT: Allows a measured launch of a hypervisor at any point and creates a dynamic root-of-trust EPT/VPID: Allows hardware to take a bigger role in memory and cache separation and management 8

Technical Overview VMM Architecture } VMMs are either Type-I or Type-II Guest Guest Guest Guest Hypervisor Hypervisor Host Operating System Hardware Hardware } Examples of Type-I Xen, VMWare ESX, Hyper-V } Examples of Type-II VirtualBox, KVM, VMWare Player 9

Technical Overview VMM Architecture II } Different types lead to different hardware multiplexing models } Type-I VMMs generally have a control domain (dom0) which can directly talk to hardware and multiplex all requests from guests don t want to need drivers in VMM More secure and isolated, no full OS in TCB } Type-II VMMs use the hardware drivers of host OS Simpler to install, just an application on host OS 10

Technical Background Virtual Memory } Paging provides an operating system with a means to organize physical memory while at the same time, providing executables with an abstracted, contiguous view of memory Viralpatal.net 11

Technical Overview Page Translation } Every memory access requires several memory bus transactions to perform page translation This is slow! CPU Memory Get PD Entry Get PT Entry Get Memory PD Data PT Data Memory Data 12

Technical Overview Translation Lookaside Buffer } The solution to this problem is to cache previous translations in a buffer called the Translation Lookaside Buffer (TLB) Access Memory Is Translation in TLB? Yes No Get PDE Get PTE Cache Get Memory 13

Technical Overview Memory Management } Extended page tables (EPT) adds additional levels to traditional virtual memory hierarchy Maps guest physical to machine physical Triggers EPT Fault VM Exit instead of page fault Allows OS to manage memory without VMM interference Implements new instructions similar to INVLPG } VM process ID (VPID) adds a word to each TLB line with the VM ID (VMM = ID 0) to prevent performance hit from VM Exit TLB flush 14

Technical Overview VMCS Mechanics } Think of a VMCS as a task state segment (TSS) or task_struct for OS VMs } One VMCS PTR per processor, points to currently active VMCS } VMCS stores guest and host state, exit conditions and pointers to other related structures } Not directly accessible to memory reads/writes, requires a specialized instruction to access (VMREAD/VMWRITE) 15

Technical Overview VM Exit Conditions } Among others, the VMCS can be configured to trap on: Interrupts Memory faults (akin to page faults) IO access (port IO) Certain privileged instructions MOV to control registers RDMSR/WRMSR RDRAND Etc } When trapping to VMM, provides all guest registers/ state and exit condition 16

Technical Aside TXT & SMM } Intel trusted execution technology (TXT) provides the ability to establish a dynamic root-of-trust Sets TPM (hardware crypto co-processor) into special mode as well as CPU(s) and launches measured launch environment Can detect tampering of hypervisor or OS Removes legacy BIOS and additional untrusted software from trusted computing base (TCB) } Intel system management mode (SMM) is a stealthy execution environment ( ring -2 ) for chipset manufacturer code to live Fully hidden in HW from OS/hypervisor SMRAM inaccessible Can host a 2 nd VMM that virtualizes chipset code 17

Interesting Research Private key side-channel leakage } VT-x may provide strong isolation, but side-channels still exist Timing Shared processor cache IO } Extracted a private key being used in a VM from another co-resident VM on the Xen hypervisor Used cache timing (similar to AES attack) to figure out what memory other VM was accessing Able to recover ElGamal private key in lab setting } Reminder that VT-x is not designed for total isolation 18

Technical Background TLB } TLB is physically two separate entities, one for code, one for data 19

Interesting Research Measurement of running executables } Built upon J. Butler s Shadow Walker rootkit to split TLB to provide periodic measurements of dynamic code applications } Transparently segregates code and data fetches to different regions of memory } Can detect code-injection attack almost instantly } DARPA Cyber Fast Track effort 20

Interesting Research NoHype } Looked at method to remove VMM from trusted computing base by doing away with the VMM alltogether } Allocates resources directly to VMs at boot, then removes itself from memory, only leaving default handler to terminate VM } Interesting way to (mis)use existing technologies to gain an unexpected benefit 21

Possible Future Work Ideas Invite me to your conference talks! } NUMA SSI Show that it is possible to execute unmodified NUMA OS on a number of computers using VT-x as a way to hide details of system The complexity of the Intel MMU is already Turing-complete, with VT-x, it is capable of completing changing its apparent hardware architecture via software } ELFbac VMM ELFbac (Bangert et al) increased OS introspection into intent of ELF applications to increase security Linux kernel modules are ELF files running in ring 0, able to bypass memory protections and kernel-level defenses Thin hypervisor shim (no hardware emulation) to introspect in similar way and enforce intent on kernel-code 22

Concluding Remarks } Hopefully this provided enough of an overview of Intel VT-x for you to feel confident to play with it } I have a simple hypervisor which I built on for MoRE for anyone who is interested Windows 7 x86 kernel driver Loads thin hypervisor into VMM slot } Don t hesitate to contact me with questions or to bounce ideas around 23

Questions? } Bedankt! 24