Running virtualized native drivers in User Mode Linux V. Guffens, G. Bastin UCL/CESAME (Belgium)

USENIX’05 / Freenix track Anaheim, USA, June 10-15, 2005

Running virtualized native drivers in User Mode Linux – p.1/30

Outline Overview of User Mode Linux (UML) A wifi layer for UML Principle Architecture Applications wireless setup emulator Teaching tool

Running virtualized native drivers in User Mode Linux – p.2/30

PART I

Overview of User Mode Linux

Running virtualized native drivers in User Mode Linux – p.3/30

User Mode Linux Mainly developed by Jeff Dike Started in February 1999 (Registered at sourceforge in November 1999) UML architecture is described in papers found on the UML kernel home page (OLS’01, OLS’02) Integrated in the official Linux 2.6.9 tree

Running virtualized native drivers in User Mode Linux – p.4/30

Overview of User Mode Linux UML runs as a process U M L ls

ps

netscape Generic kernel

Drivers

Architecture Layer

Hardware : CPU, disks, networks, terminal, ...

Running virtualized native drivers in User Mode Linux – p.5/30

Overview of User Mode Linux Virtualised kernel, new Linux architecture ls

ps

netscape

Generic kernel ls

ps

netscape

UML Drivers

U M L

UML architecture

Generic kernel Drivers

Architecture Layer

Hardware : CPU, disks, networks, terminal, ...

Running virtualized native drivers in User Mode Linux – p.5/30

Overview of User Mode Linux No attempt to run an unmodified OS ls

ps

netscape

Generic kernel ls

ps

netscape

UML Drivers

U M L

UML architecture

Generic kernel Drivers

Architecture Layer

Hardware : CPU, disks, networks, terminal, ...

Running virtualized native drivers in User Mode Linux – p.5/30

Achieving virtualization System calls : 2 modes Tracing thread mode (tt) Separate Kernel Address Space (skas), requires a patch on the host Hardware is emulated UML block devices associated with a file on the host which contains a filesystem Interrupts are replaced by signals network devices use a hub daemon on the host OR ethertap, . . . Running virtualized native drivers in User Mode Linux – p.6/30

System calls tt mode One process on the host per process on UML + tracing thread process use ptrace syscall to intercept the UML syscall, nullify it run the syscall handler in UML kernel skas mode Only 4 process/UML on the host use a /proc/mm interface on the host to change address space Running virtualized native drivers in User Mode Linux – p.7/30

Hardware emulation, example uml-gw:˜# cat /proc/interrupts CPU0 0: 2147 SIGVTALRM 2: 40 SIGIO 3: 0 SIGIO 4: 4906 SIGIO 9: 0 SIGIO 10: 0 SIGIO 11: 38 SIGIO

timer console console-write ubd mconsole winch, winch write sigio

Running virtualized native drivers in User Mode Linux – p.8/30

PART II

A wifi layer for UML

Running virtualized native drivers in User Mode Linux – p.9/30

UML-wifi Principle UML1 UML2 host1

{

tcp connection

UML3 host2

Simulator server

UML is used to create virtual machines Machines are interconnected through a simulator server Running virtualized native drivers in User Mode Linux – p.10/30

Needed components 1/2 Wireless Network interface with wireless extension in UML Write a specific UML driver similar to what exists now in UML Use an existing wireless driver and virtualize it

Running virtualized native drivers in User Mode Linux – p.11/30

Needed components 1/2 Wireless Network interface with wireless extension in UML Write a specific UML driver similar to what exists now in UML Use an existing wireless driver and virtualize it

Use hostap driver Running virtualized native drivers in User Mode Linux – p.11/30

Needed components 2/2 Physical layer Forward the packets from nodes to nodes Drops the packets when needed (probability loss model) graphical display Visualise what happens in the network Easily create an arbitrary topology

Running virtualized native drivers in User Mode Linux – p.12/30

The hostap driver (Jouni Malinen) Supports multiple hardware type PCI, PCMCIA → Add a UML layer Supports a host AP mode in software

Running virtualized native drivers in User Mode Linux – p.13/30

Inserting the hostap driver in UML unresolved PCI related symbols in hostap_pci $ nm hostap_pci.o | grep pci | grep U U pci_disable_device U pci_enable_device U pci_register_driver U pci_restore_state U pci_save_state U pci_set_power_state U pci_unregister_driver + writew and readw Running virtualized native drivers in User Mode Linux – p.14/30

Inserting the hostap driver in UML No PCI bus in UML Add a new virtual bus in UML : netbus Replace the PCI-dependent code of the hostap driver

Running virtualized native drivers in User Mode Linux – p.15/30

Inserting the hostap driver in UML $ nm hostap_uml.o | grep netbus | grep U U netbus_finish_interrupt U netbus_read_interrupt U netbus_readw U netbus_recv U netbus_register_device U netbus_request_irq U netbus_send U netbus_unregister_device U netbus_writew

Running virtualized native drivers in User Mode Linux – p.16/30

Interconnection with UML Virtual machine

App. syscal

Linux hostap kernel exported symbols driver code netbus tcp separated processes

new exported symbols

virtual external device

Hostap driver can be inserted in UML Need to act on an emulated device

Running virtualized native drivers in User Mode Linux – p.17/30

Device emulation Simulator server written as a tcp server in QT/C++ Each device is and object instantiated when a connection is established driver may read and write word in device memory, status register is emulated A second tcp connection is used to send interrupt requests

Running virtualized native drivers in User Mode Linux – p.18/30

Physical layer emulator Each device has a 2D physical position (x, y) Empirical and theoretical models are available for path lost against distance Packet error rate may be calculated with Signal-to-Noise ratio depending on the digital modulation Include a mobility model

Running virtualized native drivers in User Mode Linux – p.19/30

Simulator architecture UML machine hostap driver tcp client1

UML machine hostap driver tcp clientN

netbus

netbus

virtual wireless card

virtual wireless card

Wireless network Physical layer emulation

Network visualisation window simulation server

Running virtualized native drivers in User Mode Linux – p.20/30

Demo See the video

Visualisation toolbar Mobile nodes

Fixed nodes

Running virtualized native drivers in User Mode Linux – p.21/30

PART III

Applications

Running virtualized native drivers in User Mode Linux – p.22/30

A testbed environment 1/4 testing Ad hoc On-Demand Distance Vector Routing

uml6 uml6 tries to ping uml3

uml5

Setup runs for hours (with mobile nodes) Connectivity is broken

uml3

Running virtualized native drivers in User Mode Linux – p.23/30

A testbed environment 2/4 Troubleshooting

uml6 uml6 tries to ping uml3

uml5 uml3

Route Table at uml6 ---------------------------------------------IP | Seq | Hop Count | Next Hop ---------------------------------------------192.168.0.2 1 1 192.168.0.2 192.168.0.5 1 1 192.168.0.5 192.168.0.6 1 0 192.168.0.6 ----------------------------------------------

Running virtualized native drivers in User Mode Linux – p.24/30

A testbed environment 3/4 Troubleshooting

uml6 uml6 tries to ping uml3

uml5 uml3

Route Table at uml3 ---------------------------------------------IP | Seq | Hop Count | Next Hop ---------------------------------------------192.168.0.7 1 1 192.168.0.7 192.168.0.6 1 1 192.168.0.6 192.168.0.5 1 1 192.168.0.5 192.168.0.3 1 0 192.168.0.3 ----------------------------------------------

Running virtualized native drivers in User Mode Linux – p.25/30

A testbed environment 4/4 Troubleshooting

uml6

transmission power of UML3 > UML6 uml5 uml3

Classical asymmetric link problem

Running virtualized native drivers in User Mode Linux – p.26/30

Developpment and testing All the software available in Linux may be used in a wireless environment Easily develop and test new solution

Running virtualized native drivers in User Mode Linux – p.27/30

Developpment and testing example: name resolution in MANET (draft-engelstad-manet-name-resolution-01)

Uses a modified proxy dns server (dnrd) 8

dns reply

2

DNS protocol AODV protocol

dns query

DNS PROXY

app.

lo uml01.air

1 7

6

ping uml03.air

RREP

NREP_EXT

this is my name

uml03.air

uml02.air 4 not my name

3

RREQ

NREQ_EXT

5

RREQ

NREQ_EXT Running virtualized native drivers in User Mode Linux – p.27/30

A teaching tool 1/2 Study the interactions between a driver and the kernel (ex. sending a command) driver driver

interrupt

enqueue(struct cmd) cmd_issue() outw

card

prism2_interrupt() dequeue(cmd) cmd−>callback()

acknowledge

Running virtualized native drivers in User Mode Linux – p.28/30

A teaching tool 2/2 (1) writew(0x10,0x4) (2) writew(0x0,0x8) (3) writew(0x10b,HFA384X_CMD_OFF)

write param0 in PARAM0_OFF(0x4) write parma1 in PARAM1_OFF(0x8) write the command in command register

the frame + header previously stores in card memory at address param0:param1 (0x1000) is sent (4) Interrupt evStat=0x18,inten=0xe09f (5) readw(0x60) (6) (7) (8) (9)

readw(0x64) writew(0x10,HFA384X_EVACK_OFF) Interrupt evStat=0x8,inten=0xe09f writew(0x8,HFA384X_EVACK_OFF)

sent the interrupt to the processor read the event status register verify if interrupt enable acknowledge cmd acknowledge alloc

Running virtualized native drivers in User Mode Linux – p.29/30

Conclusion and future work Conclusion Highly realistic simulations Good teaching and development tool

Running virtualized native drivers in User Mode Linux – p.30/30

Conclusion and future work Conclusion Highly realistic simulations Good teaching and development tool Future work Add more features (AP mode, rate limitation, . . . ) More stable code

Running virtualized native drivers in User Mode Linux – p.30/30

Conclusion and future work Conclusion Highly realistic simulations Good teaching and development tool Future work Add more features (AP mode, rate limitation, . . . ) More stable code Thank you !

Running virtualized native drivers in User Mode Linux – p.30/30

Running virtualized native drivers in User Mode Linux

on the host which contains a filesystem. Interrupts ... Only 4 process/UML on the host ... code netbus. App. hostap driver new virtual external device tcp exported.

798KB Sizes 1 Downloads 146 Views

Recommend Documents

Running virtualized native drivers in User Mode Linux ∗
web hosting solutions, honeypots and redundant ser- ... ing a tap interface on the host side and by present- ... other trough a network server that we have de-.

Linux Device Drivers, Third Edition Editor
by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman. Copyright © 2005, 2001, 1998 O'Reilly Media, Inc. All rights reserved. Printed in the United ...

Running Linux, 4th Edition
author assume no responsibility for errors or omissions, or for damages resulting from ...... group of developers working from the original AT&T Unix sources. ...... Most Linux users use a dial-up connection through an ISP to connect to the Internet

applying user-mode memory scanning on windows nt
Email [email protected]. ABSTRACT ... anti-disinfection strategies in creating malware that: • Is stealthier and .... native application to clean up any unresolved infections ...... http://www.phrack.org/issues.html?issue=65&id=10# article.

applying user-mode memory scanning on windows nt
are achieved via Windows hooks, the registry, injecting a new thread into the address space of the .... could hook the user-mode API used to enumerate services.

Mode and User Selection for Multi-User MIMO WLANs ...
these methods require could substantially mitigate the benefits of MU-MIMO ... group selection because the indoor Wireless LAN (WLAN) environment usually ...

Preserving I/O Prioritization in Virtualized OSes
First, CPU accounting in guest OSes can be inaccurate under discontinuous time, leading to false identi- cation of I/O-bound task as compute-bound. Second and most importantly, work-conserving (WC) scheduling, which is designed for continuous CPU ava

Tracing Packet Latency across Different Layers in Virtualized Systems
Aug 5, 2016 - tracing mechanisms and this calls for a system level and application transparent tracing tool. There exist ... trace network latency at packet level in virtualized environ- ments. TC timestamps packets at ..... its fair CPU share, it al

Bin Repacking Scheduling in Virtualized Datacenters
The capacity constraint has been remodeled to also avoid the use of set variables to store the number of. VMs running on servers. capacity is now modeled with one among [1] constraint that directly counts the. VMs assigned to .... The accelerator fac

On Exploiting Page Sharing in a Virtualized Environment - an ...
On Exploiting Page Sharing in a Virtualized Environment ... dy of Virtualization Versus Lightweight Containers.pdf. On Exploiting Page Sharing in a Virtualized ...

Small is Better: Avoiding Latency Traps in Virtualized ...
lution for improving latency in virtualized cloud envi- ronments. In this approach ..... kernel network stack has been a hot topic in the Linux community, and ... Cloud. Network. Server VM. Client VM. Good VM. Server VM. Bad VM. Physical Machine. Phy

Effective VM Sizing in Virtualized Data Centers
gated resource demand of a host where the VM may be placed. Based on effective sizing, we .... smaller VMs (relative to the hosting server's capacity) since.

Performance Models for Virtualized Applications
new tools for predicting performance, providing information for resource alloca- .... In other words, models depend on data collected by measurement tools in ...