#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass report \begin_preamble \input{preamble} \end_preamble \language english \inputencoding auto \fontscheme times \graphics default \paperfontsize 11 \spacing double \papersize letterpaper \paperpackage a4 \use_geometry 1 \use_amsmath 1 \use_natbib 1 \use_numerical_citations 1 \paperorientation portrait \leftmargin 1.5in \topmargin 0.9in \rightmargin 1in \bottommargin 1in \headsep 0.17in \footskip 0in \secnumdepth 4 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle fancy \layout Chapter Comments on User Mode Linux and Testing Perl Script \begin_inset LatexCommand \label{cha:Comments-on-User} \end_inset \layout Standard \begin_inset ERT status Collapsed \layout Standard \backslash thispagestyle{empty} \end_inset \begin_inset ERT status Collapsed \layout Standard \backslash renewcommand \backslash figurename{Fig.} \end_inset The general setup is fairly straight forward. The UML web-page hosted by sourceforge has vast amounts information about setting up UML \begin_inset LatexCommand \citep{Dike} \end_inset . The trick is setting up the network section with debugging. The documentation for setting up the network section is not detailed. \layout Section Installing the UML utilities \layout Standard The first thing is to install the UML tools. The UML tools allow the virtual networks to talk to each other and provides additional support tools. \layout Standard To install the UML utilities, download the uml_utilities_.tar.bz2 from the user mode linux download page (http://user-mode-linux.sourceforge.net/dl -sf.html). With root privilege, uncompress the tar.bz2. This will uncompress the source into a directory "tools". Change the directory into tools and execute a \begin_inset Quotes eld \end_inset make all \begin_inset Quotes erd \end_inset . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none tar xvjf uml_utilities.tar.bz2 \family default \series default \shape default \size default \emph default \bar default \noun default \color default \newline cd tools; make all \newline make install \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: unpacking UML tools} \end_inset Unpackaging UML tools \end_inset \layout Standard This will install the UML tools on the host machine. Again these tools are needed for the UML sessions to communication with each other. \layout Standard There are five main tools. It is not necessary to call them up or use them by command line prompt. The UML session needs the tools installed and will use them in the background. The five main tools are: \layout Itemize uml_moo - merge COW(Copy On Write) file with its backing file \layout Itemize uml_mconsole - UML management console \layout Itemize uml_switch - switch daemon \layout Itemize uml_net - setuid helper for network setup \layout Itemize tunctl - create and control TUN/TAP interfaces \layout Section Compile the kernel the UML kernel \layout Standard The Linux sourced code is available at the kernel.org repository \begin_inset LatexCommand \citep{Torvalds} \end_inset . At the time of the experimenting with UML the newest kernel was 2.4.18. The Linux kernel is intimidating . Unpackaged the code is about 300 MegaBits without any builds. \layout Standard he program "patch" updates the source code. For any Perl fans, this is the same patch invented by Larry Wall. It is used for maintaining source code and for distributions of versions. Patch takes a diff file (differences of the original file and newer file) and makes the original file a newer version. Take the UML patch file and apply it to the root level of the UML source code. The UML patch is available from the UML sourceforge web-page (the file name looks similar to: uml-patch-2.4.19-51.bz2). The bz2 extension represents bzip2 format (a compression format similar to zip files. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: installing UML patch} \end_inset shows how to uncompress the file type and apply the uncompressed patch file. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left bunzip2 uml-patch-2.4.19-51.bz2 \newline patch -p1 < uml-patch-2.4.19-51 # at the root level of the source code \layout Standard \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: installing UML patch} \end_inset Installing UML patch file \end_inset \layout Standard Notice the file name does not have the .bz2 extension. The patch command can actually work from a couple of different levels. The -p1 means at the root level of the source code. -p0 means one directory above (../ directory) and the updates are redirected into the directory. \layout Standard Once the patch is applied, the next step is to compile the kernel code. This is going to involve two commands. These commands are shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: UML make} \end_inset and need to be executed at the top level of the patch Linux source tree. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left make xconfig ARCH=um \newline make linux ARCH=um \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: UML make} \end_inset UML Make command \end_inset \layout Standard The GUI menu screen in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: UML make config screen} \end_inset should pop up. \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/xconfigScreen2.eps display none keepAspectRatio \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: UML make config screen} \end_inset Uml make config screen \end_inset \layout Standard Just the default is good. To tweak the kernel a little more, click the "kernel hacking" button and turn on all four options. This adds some extra information in the back-traces and also ensures the debugging component of the kernel is working properly. In the newer kernel (2.4.18+), especially with the skas mode patch into the host kernel setting these debug options breaks the compile. Turning on all the options for the "kernel hacking" in kernel version before 2.4.17 gave additional debug information to be used while debugging the kernel. This thesis' experiments are based on the 2.4.26 kernel which works with the skas host patch. \layout Standard After setting the desired options, hit the "save and exit" button and exit the GUI. This will save the configuration into a file called, \begin_inset Quotes eld \end_inset .config. \begin_inset Quotes erd \end_inset \begin_inset Quotes eld \end_inset .config \begin_inset Quotes erd \end_inset is a hidden file. \layout Standard There were two commands mentioned (patch -p1 < uml-patch-2.4.19-51; make xconfig). If the next command does not execute properly, try \begin_inset Quotes eld \end_inset make dep ARCH=um. \begin_inset Quotes erd \end_inset There have been instances where the UML kernel would not compile completely. "make dep ARCH=um" fixes the problem. \layout Standard \begin_inset Quotes eld \end_inset make linux ARCH=um \begin_inset Quotes erd \end_inset creates the Linux executable at the top level of the Linux kernel source tree. The compile should take almost 10 minutes the first time the UML Linux kernel is compiled. Once the kernel is compiled; the second compile only builds modified objects. So, future recompilation do not take as long. Once the Linux executable is create the just copy the "linux" file to the same directory as the root_fs. \layout Section Creating the root_fs \layout Standard If an experimenter is bold enough to create their own root_fs, there are tools to assist in this venture. For those who prefer the simple, a root_fs' can be downloaded from the UML's sourceforge website. \layout Standard Slackware is probably the purest Linux distribution, meaning the programs and libraries are not "enhanced" for a specific Linux kernel and architecture. A root file systems build with RedHat are the worst violators of changing or enhancing source code to perform better. UML is an architecture built on virtual software devices, not optimized for RedHat's enhancements. \layout Standard One way to make a custom root_fs is to create an empty root system file (maybe 400-600 megs) with the "dd" command (dd if=/dev/zero of=new_filesystem seek=100 count=1 bs=1M). Then mount the empty root_fs using "mount -o loop" and follow the instructions from the document "linux from scratch" \begin_inset LatexCommand \citep{Beekmans} \end_inset . This will create a personalized Linux distribution. Creating a root_fs from a distribution might be better. \layout Standard There are four tools are available to create root_fs \begin_inset Foot collapsed false \layout Standard http://user-mode-linux.sourceforge.net/fs_making.html has more information about these tools \end_inset \begin_inset LatexCommand \citep{Dike} \end_inset ; the two most common are uml builder \begin_inset LatexCommand \citep{Binns} \end_inset and mkrootfs \begin_inset LatexCommand \citep{Brokmeier2004} \end_inset . Both tools use RPM distributions (i.e., Redhat, Suse, and Mandrade). Mkrootfs is a very simple tool for advanced users and is command line. Mkroofs is mainly used for creating multiple root_fs from a script. Uml Builder is a simple GUI interface for single root_fs creation. \layout Standard Uml Builder has a step by step interface allowing for networking and xwindow setup. At the end of the setup, the GUI creates the script file for turning on the xwindows. As a side note, the script file for turning on xwindows is not an easy script file. Unlike turning on networking and debugging, the script for setting up xwindows is extremely complicated, is sparely documented on the web, and is pages long. If a script for xwindows is needed, consider the twenty minute configuration time with uml builder oppose to hacking the instructions. \layout Section Resizing the root_fs \layout Standard There are times when resizing the file system is necessary because the default size is not enough. To increase the file size just do these three command in the frame below. The file size in this example is increased to 640 MB, but the 640 MB can be changed to a more desirable size. resize2fs is part of the e2fsprogs utility suite \begin_inset LatexCommand \citep{Systems} \end_inset for ext2 file format. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left dd if=/dev/zero of=root_fs bs=1 count=0 seek=640MB \newline e2fsck -f root_fs \newline resize2fs -p root_fs \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Resize UML filesystem} \end_inset Resizing a uml filesystem \end_inset \layout Section Parameters for running UML \layout Standard If the root_fs is in the same directory where the Linux executable is launched, the user can merely type "./linux" and UML should start. Parameters are not really needed. The parameters are used for networking options, redirecting the location of the root_fs, and setting the memory. The main advantage for this appendix is the debugger setup. When debugging UML, have the Linux executable and the source at the top level of the source tree. If the UML exectuable is located somewhere else, the debugger (gdb) cannot find the source code. Fig.\SpecialChar ~ is an example of a script used to run UML. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ./linux umid=windom mem=128M debug=go ubd0=root_fs udb2=swap \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: running uml} \end_inset Running uml \end_inset \layout Standard This example is without network connection (networking will talked about in the next section). The ./linux, represents in this current directory. There are RPM binary versions of UML (which do not allow for debugging and other good stuff). The RPM binary version of UML installs the Linux executable in the /usr/bin. Now while this is nice and good, it interferes with the running of the Linux executable. The directory paths are confused and UML no longer had debugging capability. This is what happens when there are two versions of the same file both in the path. This is not an uncommon problem, so make a note. Run the Linux executable with the current directory symbol in the front. It is an extra "./". \layout Standard The umid=windom is a label given to the Linux kernel. The UML utilities references the UML session by the label passed in with umid=. The UML utilities controls the networking, monitors UML sessions, and provides a jail program to catch hackers. \layout Standard The mem=128M is the memory UML will be reserving. This is defaulted to 128 megabits, but can be as low as 16 M (16 megabit) without xwindows. Most of the machines used for the experiments only had 512 megabits and with three machines at 128, it left the host operating system with 128. Not good. \layout Standard The debug=go is an important switch. This switch does not work if the skas is patched into the host machine's kernel. \layout Standard The udb0=root_fs is the name of the root_fs. If this option is left blank, the Linux kernel executable will default to root_fs. \layout Standard The last option, udb2=swap is the swap space for the UML. The "swap" is assigned to udb2 and is not a file but use the host kernel's swap. \layout Section Network Setup \layout Standard There are two more optional parameters which were not mentioned. These options are for the networking. While UML has five different network drivers it can utilize, the two main virtual network drivers are Tuntap and Ethertap. \layout Standard A UML session requires two IP addresses per device driver \begin_inset LatexCommand \citep{Dike2001} \end_inset . The first IP address needs to be in the command line prompt, and the second IP address is used by the "ifconfig" utility within the UML session. The Ethertap and Tuntap virtual network drivers need two IP addresses to interface with the IP Tables and the virtual machines. In Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: RoutingTable} \end_inset is a copy of what the routing tables look likes after the UML interface drivers (tuntap drivers) are interfaced with the host machine's networking components. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/routingTable.eps display none \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: RoutingTable} \end_inset Routing table with tuntap entries \end_inset \layout Standard On the far right, there are two interfaces labeled tap0 and tap1. These interfaces are used by the UML session stating 128.198.60.172 and 128.198.60.17 3 are to be routed to the virtual machines using the tuntap drivers. \layout Standard The next section will talk about the first of the two drivers Ethertap more in depth. While it is possible to have two UML sessions using either Tuntap or Ethertap, Ethertap is the older of the two and is no longer recommended in UML developmen t. It still deserves some mention. \layout Subsection Ethertap \layout Standard Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: Ethertap} \end_inset is a command line using Ethertap. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ./linux umid=windom eth0=ethertap,,,128.198.60.133 mem=60M udb2=swap \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Ethertap} \end_inset Uml run with ethertap \end_inset \layout Standard eth0=ethertap,,,128.198.60.133 is the command line parameter which interfaces with the IP routing table entry for Ethertap. Ethertap is another device driver similar to the Ethernet driver and provides packet reception and transmission for the application level. Ethertap does not allow for multiple network interfaces in a UML session and is not as secure as Tuntap. \layout Subsection Tuntap \layout Standard Tuntap like Ethertap is a virtual network device driver and interfaces with the host machine's IP routing table. Tuntap does allow for a UML session to have multiple interfaces to the host machine's routing table. For a while, the use of Joseph Mac's Linux Virtual Machine (LVS) was pondered. LVS requires two network interfaces to do a NAT (Network Address Translation). The first network interface was for the back-end servers and the other for general Internet access. Having one UML session with two network interfaces allows for the creation of many virtual Local Area Networks (LAN's) on one machine. \layout Standard Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: Tuntap} \end_inset is a command line using tuntap using a single interface: \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ./linux umid=windom eth0=tuntap,,,128.198.60.172 mem=128M // \newline debug=go ubd0=root_fs udb2=swap \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Tuntap} \end_inset Uml run with tuntap \end_inset \layout Standard The umid=windom is used for assigning an ID to the UML session. As a side note, the ID to the UML session is used by the UML utilities tools to monitor and give external commands to the UML session from the host machine. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: 2 Tuntap} \end_inset is the command line parameters for two network interfaces. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ./linux umid=windomCM eth0=tuntap,,,128.198.60.162 eth1=tuntap,,,128.198.60.163 // \newline mem=128M debug=go ubd0=root_fs udb2=swap \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: 2 Tuntap} \end_inset Uml run with two tuntap interfaces \end_inset \layout Standard Add an additional "eth(n)" driver (where n is the number of the device) gives the UML session another network device. If there is another Tuntap driver, an additional IP address needs to be assigned through the command line. \layout Section Once inside the UML session \layout Standard Run the commands in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: ifconfig} \end_inset at the UML prompt to gain network connectivity. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ifconfig eth0 172.31.0.169 \newline route del -net 172.31.0.0 dev eth0 netmask 255.255.0.0 \newline route add -host 172.31.0.101 dev eth0 \newline route add default gw 172.31.0.101 \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: ifconfig} \end_inset Ifconfig commands for setting up the network device \end_inset \layout Standard Where 172.31.0.169 is the IP address of the UML session (not the same IP address as the one passed in). 172.31.0.0 representing the subnet. 172.31.0.101 represents the host machine's IP address. This IP address will be used as a gateway for the UML session. A script file can set all the network options once UML session starts. To adding a second network interface, add the command line parameters in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: ifconfig2} \end_inset setting the eth1 interface. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left ifconfig eth1 192.68.0.100 \newline route del -net 192.68.0.0 dev eth1 netmask 255.255.0.0 \newline route add -host 192.68.0.100 dev eth1 \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: ifconfig2} \end_inset Ifconfig commands for setting up a second network device \end_inset \layout Subsection Inside of Slackware -- configuring the Slackware root_fs \layout Standard The Slackware root_fs can be used just "as is" without any modifications. There are many tweaks that can be done to the Slackware root_fs. These tweaks include: setting the number of xterm windows spawning off, setting up the hostname, configuring dns, adding additional programs (like ssh), and how to set the routing table to automatically start up without a script or typing in the routing commands. \layout Subsection spawning off xtermals (setting the number of xterminals) \layout Standard Slackware is a pure version of Linux. The maintainers of Slackware do not make excessive modifications to Linux kernel, libraries, or programs to run well together. Not adding additional modifications makes Slackware work well with the non-conforming UML kernels. The only problem with having a "pure version", is not having the configuration utilities found in the RedHat distributions. Without these UI configuration utilities modifications are done by editing files. \layout Standard Spawning off xterminals are found in the /etc/inittab. Open up the /etc/inittab file with an editor. Scrolling down the /etc/inittab, do a search on "spawn" and grab the section listed below. \layout Standard Like most scripting languages or Linux config files the "#" means comment. In Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: swawn} \end_inset , the c0: is the terminal the UML session is called on. The remaining c1-c6 are spawned xtermals. When c1-c6 are uncommented, the UML session will bring up additional xtermals connected into the running UML sessions. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \paragraph_spacing single \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left # These are the standard console login getties in multiuser mode: \layout Standard \paragraph_spacing single \align left c0:1235:respawn:/sbin/agetty 38400 tty0 linux \newline #c1:1235:respawn:/sbin/agetty 38400 tty1 linux \newline #c2:1235:respawn:/sbin/agetty 38400 tty2 linux \newline #c3:1235:respawn:/sbin/agetty 38400 tty3 linux \newline #c4:1235:respawn:/sbin/agetty 38400 tty4 linux \newline #c5:1235:respawn:/sbin/agetty 38400 tty5 linux \newline #c6:12345:respawn:/sbin/agetty 38400 tty6 linux \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: swawn} \end_inset Spawning xterminals \end_inset \layout Subsection Setting up DNS \layout Standard Setting up the DNS consists of three parts: correctly configuring the host name, setting up the host file, and assigning the DNS servers. The first involving modifying a file called HOSTNAME (all caps). The HOSTNAME file is in the /etc directory. The file only consists of the full DNS name of the UML session. For example, an UML session with the name walden.uccs.edu would only have walden.uccs.edu inside the HOSTNAME file. \layout Standard The host file (/etc/hosts) is the first place the DNS server checks for a listing (by default). Unlike the HOSTNAME file this is not unique to Slackware, generally all Linux distributions have this file. Open and add all the DNS entries for your private network. The format is space delimited: \layout Standard The last file is the /etc/resolv.conf. The resolv.conf lists all the available DNS servers. The format is also space delimited: nameserver . Word of caution the DNS resolver is sensitive the to the host machine's firewall. If the firewall is turned on, the answer from the DNS server will not be able to make it through the firewall. The firewall is not set up to handle TAP's IP address and rejects the packet designated for TAP driver. \layout Subsection Installing and uninstalling programs \layout Standard To install a Slackware program, either mount the root_fs or turn on the host machines ftp server to get the package onto the root_fs. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: mountingRoof_fs} \end_inset shows the command to mount the root_fs. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left mount root_fs /mnt/root_fs -o loop \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: mountingRoof_fs} \end_inset Mounting a root file system \end_inset \layout Standard /mnt/root_fs is directory where the file system should be mounted. Pending on the version of Slackware, a mirror site should have the packages needed. The Slackware directory structure is awkward at first. The âdirectory listingâ file should mention where a package is kept. For example the ssh package would be under the "n" directory (for network). The package should end in .tgz extension. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: install_unInstall} \end_inset shows the commands to install and uninstall slackware packages. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left installpkg xf_bin.tgz # installs a package \newline removepkg xf_bin.tgz # uninstalls a package \newline # xf_bin is the package name \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: install_unInstall} \end_inset Installing and uninstalling slackware packages \end_inset \layout Subsection Configuring the network on startup \layout Standard Under Slackware root_fs, the network configuration file is located in /etc/rc.d. Before 9.1, fill in the IP address (IPADDR field), netmask(NETMASK FIELD), and gateway (GATEWAY field) in the rc.inet1. If there are questions, there are BOLD comments instructing what fill in. For Slackware 9.1, fill in the network parameters in the /etc/rc.d/rc.inet1.config. Filling in the config file will save time by avoiding the manually network setup (using ifconfig). \layout Section Debugging with UML \layout Standard Starting about UML kernel patch 2.4.19, Jeff Dikes (the maintainer of UML) came up with a the Skas (Separate Kernel Address Space) patch which causes the UML session to run in an entirely different host space from its processes \begin_inset LatexCommand \citep{Dike} \end_inset . It also allows for a debugger to attach to the main process and step through the Linux source code. While debugging was in the previous tt mode (Tracing Thread), a separate debug window using GDB would come up with the correct thread attached. The newer skas mode allows for outside debuggers to attach to the kernel. \layout Subsection Installing the skas patch on the host machine \layout Standard When recompiling a kernel, the default settings are missing device drivers which most distributions include as modules. Three things are needed to install the skas patch. First, get a Redhat kernel source tree as close to the skas patch version as possible. linux-2.4.22-1.2115.nptl (from Fedora core 2) works with host-skas3.patch \begin_inset LatexCommand \citep{Dike} \end_inset . Second, download a Linux kernel from the Linux Kernel Repository \begin_inset LatexCommand \citep{Torvalds} \end_inset compatible with the skas patches listed at the UML website. For this example, kernel 2.4.24 works. Once the kernel is downloaded , and unpackaged (for kernel-2.4.24.tar.bz2 type: tar xvjf kernel-2.4.24.tar.bz2; for kernel-2.4.24.tar.gz: tar xvzf kernel-2.4.24.tar.gz). Change into the top directory of the kernel code (cd linux-2.4.24) and type "make mrproper". This is a clean, just like "make clean" but stronger. Apply the skas patch, "patch -p1 < host-skas3.patch". Copy from the Redhat source kernel a config file (kernel-2.4.22-i686.config) located under linux-2.4.22-1.2115.nptl/configs. Copy this config file to the top of the 2.4.24 kernel root tree and rename it to \begin_inset Quotes eld \end_inset .config \begin_inset Quotes erd \end_inset (cp ../linux-2.4.22-1.2115.nptl/configs/kernel-2.4.22-i686.config .config) \begin_inset LatexCommand \citep{Ward2003} \end_inset . Then type "make old config". A bunch of options should come up. Set all of the them to the default (just hit return) except the âproc_mmâ, set it to true. The âproc_mmâ is the skas patch. Once this is done type "make dep; make bzImage; make modules; make modules_inst all". This will build the kernel and install the modules. Next you need to install the kernel (cp arch/i368/boot/bzImage /boot/vmlinuz-2.4. 24), set the initrd (mkinitrd /boot/initrd-2.4.24.img 2.4.24), and add a grub entry (just make a copy of a previous entry and change the initrd and vmlinuz files to match the other one). Then reboot. For additional help doing this, see the howto kernel document \begin_inset LatexCommand \citep{Lowe} \end_inset . \layout Subsection Crashing gracefully \layout Standard This section contains three tips which can help immensely when crashing the User Mode Linux session. These tips are: set a breakpoint in panic.c:panic function, verify the User Mode Linux processes are killed, and check the file system using fsck.ext2. \layout Standard User Mode Linux's kernel modifications has the scheduler call the panic.c:panic function to prompt the user when a crash occurs. This call to panic.c is good for the kernel developer in many ways: setting a breakpoint within the panic.c:panic function will create a back trace letting the developer know what caused the kernel crash and gives what values were on the stack when the crash occurred. \layout Standard When a crash occurs, the User Mode Linux's processes might still be alive and attached to the root_fs. It is always a good idea to do a process status (ps command) and pipe it with grep, looking for âlinuxâ or the UML session's ID name. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: ps umlProcess} \end_inset shows an example. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left [frank@walden bin]$ ps aux | grep linux \newline frank 3332 pts/2 S /bin/sh /home/frank/linuxRs2/runRS2 \newline frank 3333 pts/2 S /home/frank/linuxRs2/linuxRS2 (feline) [/sbin/rmmod] \newline frank 3335 pts/2 T [linuxRS2] \newline frank 3340 pts/2 S /home/frank/linuxRs2/linuxRS2 (feline) [/sbin/rmmod] \newline frank 3341 pts/2 S /home/frank/linuxRs2/linuxRS2 (feline) [/sbin/rmmod] \newline frank 3592 pts/4 S /bin/sh /home/frank/linuxRs/runRS \newline frank 3593 pts/4 S /home/frank/linuxRs/linuxRS (b2b) [/sbin/rmmod] \newline frank 3595 pts/4 T [linuxRS] \newline frank 3600 pts/4 S /home/frank/linuxRs/linuxRS (b2b) [/sbin/rmmod] \newline frank 3601 pts/4 S /home/frank/linuxRs/linuxRS (b2b) [/sbin/rmmod] \newline frank 3675 pts/5 S /bin/sh /home/frank/linuxRs3/runRS3 \newline frank 3676 pts/5 S /home/frank/linuxRs3/linuxRS3 (feline) [/sbin/rmmod] \newline frank 3678 pts/5 T [linuxRS3] \newline frank 3683 pts/5 S /home/frank/linuxRs3/linuxRS3 (feline) [/sbin/rmmod] \newline frank 3684 pts/5 S /home/frank/linuxRs3/linuxRS3 (feline) [/sbin/rmmod] \newline frank 12852 pts/8 S grep linux \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: ps umlProcess} \end_inset Checking for a uml process \end_inset \layout Standard Now there are three different UML sessions running: feline's, b2b's, and walrus. To kill the process, grab the process numbers which is the number after the owner of the process (in the example above the number after "frank"). Type "kill -9 ". All the process numbers for all the selected UML session needs to be terminated. Using the example above, the command to kill the feline UML session would be: "kill -9 3333 3340 3341 3676 3683 3684". If all the UML process are not terminated after a UML kernel crash and the UML is restarted, a message like the one in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: panicMessage} \end_inset appears. \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left VFS: Cannot open root device "ubd0" or 62:00 \newline Please append a correct "root=" boot option \newline Kernel panic: VFS: Unable to mount root fs on 62:00 \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: panicMessage} \end_inset Locked file system panic message \end_inset \layout Standard In conclusion, the most common error causing a UML session to not start (when everything else is working) is another process still attached to the root_fs. Using a "kill -9" on the UML process fixes this problem. \layout Standard The final tip is to use "/sbin/fsck.ext2 -p " to check your root_fs systems. It is about five times faster than letting the UML session do the disk check. So when the kernel crashes and all the processes are terminated, type in "/sbin/fsck.ext2 -p ", and it will check the file system a lot faster. \layout Subsection Using a .gdbinit \layout Standard Having a file called \begin_inset Quotes eld \end_inset .gdbinit \begin_inset Quotes erd \end_inset with the commands to by pass all the beginning breaks, expedites the debugger's startup. \layout Standard Before opening the gdb program, put the file â.gdbinitâ at the top of the level of the UML source. Inside the \begin_inset Quotes eld \end_inset .gdbinit \begin_inset Quotes erd \end_inset type the two lines in Fig.\SpecialChar ~ . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Tabular \begin_inset Text \layout Standard \paragraph_spacing single \align left handle SIGSEGV pass nostop noprint \newline handle SIGUSR1 pass nostop noprint \newline \SpecialChar ~ \newline \end_inset \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: gdb stopping breaks} \end_inset Stopping gdb from breaking at signals \end_inset \layout Standard The .gdbinit is the default script gdb looks for when started. This is helpful because without these two commands, gdb or any other debugger would stop every second or two. The \begin_inset Quotes eld \end_inset .gdbinit \begin_inset Quotes erd \end_inset file can be put in the home directory or use gdb -x to have gdb read the initial script. \layout Subsection Debugging in gdb \layout Standard Once gdb starts, it is really hard to break it. It is recommended to start gdb without the Linux executable file appended in the command line. Otherwise, the UML session might have to be rebooted (hitting control-c a couple of times might work). \layout Standard Start gdb. Once gdb is loaded, set it least one breakpoint. Then type "file," then the path to the Linux executable. For example: "file /home/frank/linuxSrc/linux". Gdb will automatically load the Linux executable with the correct parameters. When the program breaks, print the different variables or back-trace to better understand the kernel. For emacs user, gdb also interfaces with emacs \begin_inset LatexCommand \citep{Seager2001} \end_inset . \layout Subsection Gdb debugging inside Eclipse \layout Standard Install Eclipse. First download eclipse from one of their mirror sites \begin_inset Foot collapsed false \layout Standard An example eclipse file would be at ftp://eclipse.mirrors.tds.net/pub/eclipse.org/ec lipse/downloads/drops/R-3.0-200406251208/eclipse-platform-3.0-linux-gtk.zip \end_inset . \layout Standard Unzip the eclipse package using the unzip command "unzip eclipse-platform-3.0-lin ux-gtk.zip" also download and install the CDT plug-in. A recommended site is: ftp://eclipse.mirrors.tds.net/pub/eclipse.org/tools/cdt/rele ases/new/zips/org.eclipse.cdt-2.0-linux.gtk.x86.zip. The plug CDT in should be unzipped at the same directory level as the eclipse zip file (was unzipped). \layout Standard Creating a project. File -> New->Project; In the new project window as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: NewEclipseproject} \end_inset . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/01newProject.bmp display none width 100line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: NewEclipseproject} \end_inset New eclipse project \end_inset \layout Standard Select C->Standard Make C Project. Then hit "next" as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: makeCProject} \end_inset . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/02newProjectScreen.bmp display none width 75line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: makeCProject} \end_inset Starting a standard make c project \end_inset \layout Standard Project name is the directory where your Linux source code lives. For example, \begin_inset Quotes eld \end_inset /home/frank/ \begin_inset Quotes erd \end_inset is the workspace directory. The top level of my Linux source tree is /home/frank/linuxSrcE. The project is linuxSrcE (just linuxSrcE -- no additional directory names) as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: setup project} \end_inset . Leave "Use default" clicked on, then hit "finish". \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/03directoryLocation.bmp display none width 75line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: setup project} \end_inset Setting up a project \end_inset \layout Standard The progress window C/C++ index should be indexing the Linux tree as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: Indexer} \end_inset . The process should take about fifteen minutes to half an hour. The indexer will find all your c, h, and make files files and place them in the project. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/03directoryLocation.bmp display none width 80line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Indexer} \end_inset Code indexer \end_inset \layout Standard De-select project->build automatically. Otherwise, the framework will try and rebuild the source code everything the code is saved. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/05deselectingBuildAutomatically.bmp display none width 80line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: deselectBuildAuto} \end_inset Deselect build automatically \end_inset \layout Standard Adding a run / debug. Click the run icon ->run shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig. RunIcon} \end_inset . Another screen should come up. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/06runIcon.bmp display none width 80line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig. RunIcon} \end_inset Run icon \end_inset \layout Standard Click the "new" button at the bottom (make sure "C/C++ local" is highlighted otherwise the new button will be disabled), as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: CreateANewRun} \end_inset . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/07runScreen.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: CreateANewRun} \end_inset Creating a new run \end_inset \layout Standard Under the "main" tab as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: RunWindow} \end_inset . In the name field, call the project anything. The example uses "linuxSrcE," same as the project name. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/08linuxSrcESettings.bmp display none width 100line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: RunWindow} \end_inset Run main window \end_inset \layout Standard Under the "argument" tab (Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: RunArgument} \end_inset ) put the arguments used to run uml (i.e. linux ). The arguments the example UML session uses are: "udb0=/home/frank/root_fs umid=lamb eth0=tuntap,,,172.31.0.130 eth1=tuntap,,,172.31.0.131 mem=32M udb2=swap". \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/09arguments.bmp display none width 100line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: RunArgument} \end_inset Run argument window \end_inset \layout Standard Under the "debugger" tab(Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig. DebugWindow} \end_inset ). Set the drop down combo box to "GDB debugger" and click the radio button "run program in debugger". De-select "Stop at main() on startup"GDB debugger. Gdb debugger should be gdb. If you have built a newer version, put in the absolute directory where the newer gdb is located. In "GDB command file", put the location of your ".gdbinit" file. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/10debugTab.bmp display none width 100line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig. DebugWindow} \end_inset Debug Window \end_inset \layout Standard Add a make file. Window->Show view->Make target. The "make target" window on the side should come up (Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: AddingAMakeTarget} \end_inset ). Right click on the root directory (in the example linuxSrcE) and click add make target. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/11addMakeBuild.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: AddingAMakeTarget} \end_inset Adding a make target \end_inset \layout Standard A window "Create a new make target" should come up. Fill in the target name with a label for the make command; the example uses \begin_inset Quotes eld \end_inset linux ARCH=um \begin_inset Quotes erd \end_inset . In the "make target" field fill in \begin_inset Quotes eld \end_inset linux ARCH=um \begin_inset Quotes erd \end_inset , then de-select \begin_inset Quotes eld \end_inset use default \begin_inset Quotes erd \end_inset . In "build command," type "make linux ARCH=um". Un-select "stop on first build error" and select "run all project builders." Hit the "create" button. Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: MakeTarget} \end_inset is a filled in window. Setup part is done. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/12newMakeTarget.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: MakeTarget} \end_inset Setting up make target \end_inset \layout Standard To build the source, right click the newly created make target and select "run make" as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: BuildingMaketarget} \end_inset . \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/13runMake.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: BuildingMaketarget} \end_inset Building make target \end_inset \layout Standard To run there should be a icon on the tool bar (green circle with a white play triangle) as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: Running program} \end_inset . It should drop down and you should see the name of the run session. \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/14runProgram.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Running program} \end_inset Running the program \end_inset \layout Standard To debug there should be a cockroach looking icon next to the run as shown in Fig.\SpecialChar ~ \begin_inset LatexCommand \ref{Fig: Start debugger} \end_inset . Click it and you should see the name of the run session. Once you start debugging, there are two windows you should be looking for the "console" and the "debug". \layout Standard \begin_inset Float figure placement H wide false collapsed false \layout Standard \align center \begin_inset Graphics filename Figures/uml/15debugProgram.bmp display none width 50line% \end_inset \layout Caption \begin_inset LatexCommand \label{Fig: Start debugger} \end_inset Start the debugger \end_inset \layout Section Perl script used for testing \layout Standard There are two perl scripts used for testing, client.pl and server.pl (both included with the media). The client.pl reads read in an input file called input.txt and setsup the proc file system by sending commands to the system prompt. The commands setup the kernel by changing the values in the proc file system (/proc) and also bandwidth limitation are for each of the connections. \layout Standard A TCP socket connection is established with the server.pl. The server.pl is listening for the client.pl. When client.pl starts the connection with the machine running server.pl, it sends the commands read in from the input.txt. The server.pl reads only the commands needed to setup the server. \layout Standard When the client.pl script waits one second and then start a web benchmark \begin_inset LatexCommand \citep{Zawodny2003} \end_inset to measure the speed of the connection. When the web benchmark is completed the results are parsed from the output and stored in a output file. \the_end