Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)

Slides:



Advertisements
Similar presentations
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Advertisements

Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
KVM/ARM: The Design and Implementation of the Linux ARM Hypervisor Fall 2014 Presented By: Probir Roy.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Jakub Szefer, Eric Keller, Ruby B. Lee Jennifer Rexford Princeton University CCS October, 2011 報告人:張逸文.
IBM India Software Labs FFDC Using Crash Dumps – BoF07/09/04 © 2004 IBM Corporation First Failure Data Capture Using Crash Dumps: A BoF session Linux Symposium.
Benefits: Increased server utilization Reduced IT TCO Improved IT agility.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
4/18/14 1 That was the year that was in Linux Pacific Northwest National Laboratories April 18, 2014 Rick Lindsley IBM Linux Technology Center
System Virtualization 1 Learning Objective: –To understand the implementation choices and details of System Virtualization COMP
1 CSE 451 Section 2: Interrupts, Syscalls, Virtual Machines, and Project 1.
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
© 2004, D. J. Foreman 1 Implementing Processes and Threads.
1.4 Hardware Review. CPU  Fetch-decode-execute cycle 1. Fetch 2. Bump PC 3. Decode 4. Determine operand addr (if necessary) 5. Fetch operand from memory.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Nachos Lecture 2 Xiaorui Sun. Phase 2 You have got one machine (machine package) You have to implements the incomplete OS (userprog package) Run programs.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
4/18/14 1 That was the year that was in Linux Pacific Northwest National Laboratories April 17, 2015 Rick Lindsley IBM Linux Technology Center
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
CS 140 Lecture Notes: Virtual MachinesSlide 1 Process Abstraction Instruction Set Registers MMU I/O Devices Physical Memory Virtual Memory System Calls.
Virtual Machines Mr. Monil Adhikari. Agenda Introduction Classes of Virtual Machines System Virtual Machines Process Virtual Machines.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
Lecture 13: Virtual Machines
Input/Output (I/O) Important OS function – control I/O
Input/Output Device Drivers
Virtualization.
Chapter 2: Operating-System Structures
Kernel Design & Implementation
Operating Systems Lecture 2.
Interrupts and Interrupts Handling
Processes and threads.
Interrupts and signals
CS501 Advanced Computer Architecture
Exceptional Control Flow
Virtualization Engine console Bridge Concepts
Day 08 Processes.
Day 09 Processes.
Implementing Processes and Threads
Chapter 3: Processes.
Want to play a game? – Linux Kernel Modules
CS 140 Lecture Notes: Virtual Machines
OS Virtualization.
Introduction to Operating Systems
Genesis: From Raw Hardware to Processes
Chapter 2: The Linux System Part 1
CS 140 Lecture Notes: Virtual Machines
Process Description and Control
Operating Systems Lecture 2.
Process Description and Control
Architectural Support for OS
Operating Systems Lecture 3.
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Implementing Processes and Threads
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Outline Operating System Organization Operating System Examples
Architectural Support for OS
Implementing Processes and Threads
CS 140 Lecture Notes: Virtual Machines
Operating Systems Structure
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Presentation transcript:

Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)

5 Minute Lguest Mastery Simplest virtualization possible Linux-on-linux 32-bit x86 only Code documented!

5 Minute Lguest Mastery Launcher loads/services Guest: –Documentation/lguest/lguest.c Guest kernel has lg support –drivers/lguest/lguest{,_asm,_bus}.c Host kernel has lg module –drivers/lguest/*.c

5 Minute Lguest Mastery Launcher: –Documentation/lguest/lguest.c –Writes to /dev/lguest: LHCALL_INITIALIZE LHCALL_IRQ LHCALL_GETDMA LHCALL_BREAK –Reads to run Guest –Handles devices, net/char input

5 Minute Lguest Mastery Guest: –drivers/lguest/lguest{,_asm,_bus}.c –Special lguest_net/block/console drivers –Makes "hypercalls" to Host: See include/linux/lguest.h unsigned long hcall(unsigned long call, unsigned long arg1, unsigned long arg2, unsigned long arg3)

5 Minute Lguest Mastery Host: –drivers/lguest/*.c –Switches to Guest, switched back in any interrupt or hypercall –Handles traps and hypercalls –Returns to Launcher on DMA out to "devices"

1 Minute Lguest Mastery Launcher Host /dev/lguest

1 Minute Lguest Mastery Launcher Host write():

1 Minute Lguest Mastery Launcher Host write(): LHREQ_INITIALIZE pages-of-memory address of top-level pagetable address to start executing PAGE_OFFSET for kernel

1 Minute Lguest Mastery Launcher Host read(): unsigned long dmainfo[2]

1 Minute Lguest Mastery Launcher Host read(): unsigned long dmainfo[2] -> EAGAIN (interrupted by waker) -> ENOENT (guest died) -> >0 (dma from guest)

1 Minute Lguest Mastery Launcher Host Guest

1 Minute Lguest Mastery Launcher Host Guest eax=LHCALL_LGUEST_INIT edx=address of lguest_data ebx=0 ecx=0

1 Minute Lguest Mastery Launcher Host Guest int 15 eax=LHCALL_LGUEST_INIT edx=address of lguest_data ebx=0 ecx=0

The Plan

Features

Features: Simple S-gname: Write a new hypercall which prints your name using printk(). S-lzzz: Implement a new control sequence ^Z^Z^Z

Features: Simple S-lnetst: Fix Launcher to warn if discarding packets when LGUEST_DEVICE_S_ACTIVE S-lstatus: Print out device status when 'status' comes in the control fd

Features: Simple S-greboothook: Reboot hook in Guest S-lshutdown: Launcher clean exit on Guest shutdown. S-lreboot: Have the Launcher "reboot" itself when the final read returns -ELOOP. S-lctrlzzz: Suspend when told to by the control fd

Features: Medium M-hiofix: Fix lguest I/O bug for shared pages M-lsuspend: Suspend Guest into memory file M-lrestore: Restore Guest from memory file

Features: Advanced A-lmatchmem: Print matching memory among Guests A-lsharemem: Share exported matching memory A-grtc: Implement /dev/rtc for the Guest

Legal Statement This work represents the views of the author(s) and does not necessarily reflect the views of IBM Corporation. The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countries: IBM (logo). A full list of U.S. trademarks owned by IBM may be found at Linux is a registered trademark of Linus Torvalds. Other company, product, and service names may be trademarks or service marks of others.