PageRenderTime 111ms CodeModel.GetById 49ms RepoModel.GetById 0ms app.codeStats 1ms

/Documentation/uml/UserModeLinux-HOWTO.txt

https://bitbucket.org/abioy/linux
Plain Text | 4636 lines | 2289 code | 2347 blank | 0 comment | 0 complexity | eb1de3d2f6397647dd467d54a9b0b0a8 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, GPL-2.0, LGPL-2.0, AGPL-1.0
  1. User Mode Linux HOWTO
  2. User Mode Linux Core Team
  3. Mon Nov 18 14:16:16 EST 2002
  4. This document describes the use and abuse of Jeff Dike's User Mode
  5. Linux: a port of the Linux kernel as a normal Intel Linux process.
  6. ______________________________________________________________________
  7. Table of Contents
  8. 1. Introduction
  9. 1.1 How is User Mode Linux Different?
  10. 1.2 Why Would I Want User Mode Linux?
  11. 2. Compiling the kernel and modules
  12. 2.1 Compiling the kernel
  13. 2.2 Compiling and installing kernel modules
  14. 2.3 Compiling and installing uml_utilities
  15. 3. Running UML and logging in
  16. 3.1 Running UML
  17. 3.2 Logging in
  18. 3.3 Examples
  19. 4. UML on 2G/2G hosts
  20. 4.1 Introduction
  21. 4.2 The problem
  22. 4.3 The solution
  23. 5. Setting up serial lines and consoles
  24. 5.1 Specifying the device
  25. 5.2 Specifying the channel
  26. 5.3 Examples
  27. 6. Setting up the network
  28. 6.1 General setup
  29. 6.2 Userspace daemons
  30. 6.3 Specifying ethernet addresses
  31. 6.4 UML interface setup
  32. 6.5 Multicast
  33. 6.6 TUN/TAP with the uml_net helper
  34. 6.7 TUN/TAP with a preconfigured tap device
  35. 6.8 Ethertap
  36. 6.9 The switch daemon
  37. 6.10 Slip
  38. 6.11 Slirp
  39. 6.12 pcap
  40. 6.13 Setting up the host yourself
  41. 7. Sharing Filesystems between Virtual Machines
  42. 7.1 A warning
  43. 7.2 Using layered block devices
  44. 7.3 Note!
  45. 7.4 Another warning
  46. 7.5 uml_moo : Merging a COW file with its backing file
  47. 8. Creating filesystems
  48. 8.1 Create the filesystem file
  49. 8.2 Assign the file to a UML device
  50. 8.3 Creating and mounting the filesystem
  51. 9. Host file access
  52. 9.1 Using hostfs
  53. 9.2 hostfs as the root filesystem
  54. 9.3 Building hostfs
  55. 10. The Management Console
  56. 10.1 version
  57. 10.2 halt and reboot
  58. 10.3 config
  59. 10.4 remove
  60. 10.5 sysrq
  61. 10.6 help
  62. 10.7 cad
  63. 10.8 stop
  64. 10.9 go
  65. 11. Kernel debugging
  66. 11.1 Starting the kernel under gdb
  67. 11.2 Examining sleeping processes
  68. 11.3 Running ddd on UML
  69. 11.4 Debugging modules
  70. 11.5 Attaching gdb to the kernel
  71. 11.6 Using alternate debuggers
  72. 12. Kernel debugging examples
  73. 12.1 The case of the hung fsck
  74. 12.2 Episode 2: The case of the hung fsck
  75. 13. What to do when UML doesn't work
  76. 13.1 Strange compilation errors when you build from source
  77. 13.2 (obsolete)
  78. 13.3 A variety of panics and hangs with /tmp on a reiserfs filesystem
  79. 13.4 The compile fails with errors about conflicting types for 'open', 'dup', and 'waitpid'
  80. 13.5 UML doesn't work when /tmp is an NFS filesystem
  81. 13.6 UML hangs on boot when compiled with gprof support
  82. 13.7 syslogd dies with a SIGTERM on startup
  83. 13.8 TUN/TAP networking doesn't work on a 2.4 host
  84. 13.9 You can network to the host but not to other machines on the net
  85. 13.10 I have no root and I want to scream
  86. 13.11 UML build conflict between ptrace.h and ucontext.h
  87. 13.12 The UML BogoMips is exactly half the host's BogoMips
  88. 13.13 When you run UML, it immediately segfaults
  89. 13.14 xterms appear, then immediately disappear
  90. 13.15 Any other panic, hang, or strange behavior
  91. 14. Diagnosing Problems
  92. 14.1 Case 1 : Normal kernel panics
  93. 14.2 Case 2 : Tracing thread panics
  94. 14.3 Case 3 : Tracing thread panics caused by other threads
  95. 14.4 Case 4 : Hangs
  96. 15. Thanks
  97. 15.1 Code and Documentation
  98. 15.2 Flushing out bugs
  99. 15.3 Buglets and clean-ups
  100. 15.4 Case Studies
  101. 15.5 Other contributions
  102. ______________________________________________________________________
  103. 11.. IInnttrroodduuccttiioonn
  104. Welcome to User Mode Linux. It's going to be fun.
  105. 11..11.. HHooww iiss UUsseerr MMooddee LLiinnuuxx DDiiffffeerreenntt??
  106. Normally, the Linux Kernel talks straight to your hardware (video
  107. card, keyboard, hard drives, etc), and any programs which run ask the
  108. kernel to operate the hardware, like so:
  109. +-----------+-----------+----+
  110. | Process 1 | Process 2 | ...|
  111. +-----------+-----------+----+
  112. | Linux Kernel |
  113. +----------------------------+
  114. | Hardware |
  115. +----------------------------+
  116. The User Mode Linux Kernel is different; instead of talking to the
  117. hardware, it talks to a `real' Linux kernel (called the `host kernel'
  118. from now on), like any other program. Programs can then run inside
  119. User-Mode Linux as if they were running under a normal kernel, like
  120. so:
  121. +----------------+
  122. | Process 2 | ...|
  123. +-----------+----------------+
  124. | Process 1 | User-Mode Linux|
  125. +----------------------------+
  126. | Linux Kernel |
  127. +----------------------------+
  128. | Hardware |
  129. +----------------------------+
  130. 11..22.. WWhhyy WWoouulldd II WWaanntt UUsseerr MMooddee LLiinnuuxx??
  131. 1. If User Mode Linux crashes, your host kernel is still fine.
  132. 2. You can run a usermode kernel as a non-root user.
  133. 3. You can debug the User Mode Linux like any normal process.
  134. 4. You can run gprof (profiling) and gcov (coverage testing).
  135. 5. You can play with your kernel without breaking things.
  136. 6. You can use it as a sandbox for testing new apps.
  137. 7. You can try new development kernels safely.
  138. 8. You can run different distributions simultaneously.
  139. 9. It's extremely fun.
  140. 22.. CCoommppiilliinngg tthhee kkeerrnneell aanndd mmoodduulleess
  141. 22..11.. CCoommppiilliinngg tthhee kkeerrnneell
  142. Compiling the user mode kernel is just like compiling any other
  143. kernel. Let's go through the steps, using 2.4.0-prerelease (current
  144. as of this writing) as an example:
  145. 1. Download the latest UML patch from
  146. the download page <http://user-mode-linux.sourceforge.net/dl-
  147. sf.html>
  148. In this example, the file is uml-patch-2.4.0-prerelease.bz2.
  149. 2. Download the matching kernel from your favourite kernel mirror,
  150. such as:
  151. ftp://ftp.ca.kernel.org/pub/kernel/v2.4/linux-2.4.0-prerelease.tar.bz2
  152. <ftp://ftp.ca.kernel.org/pub/kernel/v2.4/linux-2.4.0-prerelease.tar.bz2>
  153. .
  154. 3. Make a directory and unpack the kernel into it.
  155. host%
  156. mkdir ~/uml
  157. host%
  158. cd ~/uml
  159. host%
  160. tar -xzvf linux-2.4.0-prerelease.tar.bz2
  161. 4. Apply the patch using
  162. host%
  163. cd ~/uml/linux
  164. host%
  165. bzcat uml-patch-2.4.0-prerelease.bz2 | patch -p1
  166. 5. Run your favorite config; `make xconfig ARCH=um' is the most
  167. convenient. `make config ARCH=um' and 'make menuconfig ARCH=um'
  168. will work as well. The defaults will give you a useful kernel. If
  169. you want to change something, go ahead, it probably won't hurt
  170. anything.
  171. Note: If the host is configured with a 2G/2G address space split
  172. rather than the usual 3G/1G split, then the packaged UML binaries
  173. will not run. They will immediately segfault. See ``UML on 2G/2G
  174. hosts'' for the scoop on running UML on your system.
  175. 6. Finish with `make linux ARCH=um': the result is a file called
  176. `linux' in the top directory of your source tree.
  177. Make sure that you don't build this kernel in /usr/src/linux. On some
  178. distributions, /usr/include/asm is a link into this pool. The user-
  179. mode build changes the other end of that link, and things that include
  180. <asm/anything.h> stop compiling.
  181. The sources are also available from cvs at the project's cvs page,
  182. which has directions on getting the sources. You can also browse the
  183. CVS pool from there.
  184. If you get the CVS sources, you will have to check them out into an
  185. empty directory. You will then have to copy each file into the
  186. corresponding directory in the appropriate kernel pool.
  187. If you don't have the latest kernel pool, you can get the
  188. corresponding user-mode sources with
  189. host% cvs co -r v_2_3_x linux
  190. where 'x' is the version in your pool. Note that you will not get the
  191. bug fixes and enhancements that have gone into subsequent releases.
  192. 22..22.. CCoommppiilliinngg aanndd iinnssttaalllliinngg kkeerrnneell mmoodduulleess
  193. UML modules are built in the same way as the native kernel (with the
  194. exception of the 'ARCH=um' that you always need for UML):
  195. host% make modules ARCH=um
  196. Any modules that you want to load into this kernel need to be built in
  197. the user-mode pool. Modules from the native kernel won't work.
  198. You can install them by using ftp or something to copy them into the
  199. virtual machine and dropping them into /lib/modules/`uname -r`.
  200. You can also get the kernel build process to install them as follows:
  201. 1. with the kernel not booted, mount the root filesystem in the top
  202. level of the kernel pool:
  203. host% mount root_fs mnt -o loop
  204. 2. run
  205. host%
  206. make modules_install INSTALL_MOD_PATH=`pwd`/mnt ARCH=um
  207. 3. unmount the filesystem
  208. host% umount mnt
  209. 4. boot the kernel on it
  210. When the system is booted, you can use insmod as usual to get the
  211. modules into the kernel. A number of things have been loaded into UML
  212. as modules, especially filesystems and network protocols and filters,
  213. so most symbols which need to be exported probably already are.
  214. However, if you do find symbols that need exporting, let us
  215. <http://user-mode-linux.sourceforge.net/contacts.html> know, and
  216. they'll be "taken care of".
  217. 22..33.. CCoommppiilliinngg aanndd iinnssttaalllliinngg uummll__uuttiilliittiieess
  218. Many features of the UML kernel require a user-space helper program,
  219. so a uml_utilities package is distributed separately from the kernel
  220. patch which provides these helpers. Included within this is:
  221. +o port-helper - Used by consoles which connect to xterms or ports
  222. +o tunctl - Configuration tool to create and delete tap devices
  223. +o uml_net - Setuid binary for automatic tap device configuration
  224. +o uml_switch - User-space virtual switch required for daemon
  225. transport
  226. The uml_utilities tree is compiled with:
  227. host#
  228. make && make install
  229. Note that UML kernel patches may require a specific version of the
  230. uml_utilities distribution. If you don't keep up with the mailing
  231. lists, ensure that you have the latest release of uml_utilities if you
  232. are experiencing problems with your UML kernel, particularly when
  233. dealing with consoles or command-line switches to the helper programs
  234. 33.. RRuunnnniinngg UUMMLL aanndd llooggggiinngg iinn
  235. 33..11.. RRuunnnniinngg UUMMLL
  236. It runs on 2.2.15 or later, and all 2.4 kernels.
  237. Booting UML is straightforward. Simply run 'linux': it will try to
  238. mount the file `root_fs' in the current directory. You do not need to
  239. run it as root. If your root filesystem is not named `root_fs', then
  240. you need to put a `ubd0=root_fs_whatever' switch on the linux command
  241. line.
  242. You will need a filesystem to boot UML from. There are a number
  243. available for download from here <http://user-mode-
  244. linux.sourceforge.net/dl-sf.html> . There are also several tools
  245. <http://user-mode-linux.sourceforge.net/fs_making.html> which can be
  246. used to generate UML-compatible filesystem images from media.
  247. The kernel will boot up and present you with a login prompt.
  248. Note: If the host is configured with a 2G/2G address space split
  249. rather than the usual 3G/1G split, then the packaged UML binaries will
  250. not run. They will immediately segfault. See ``UML on 2G/2G hosts''
  251. for the scoop on running UML on your system.
  252. 33..22.. LLooggggiinngg iinn
  253. The prepackaged filesystems have a root account with password 'root'
  254. and a user account with password 'user'. The login banner will
  255. generally tell you how to log in. So, you log in and you will find
  256. yourself inside a little virtual machine. Our filesystems have a
  257. variety of commands and utilities installed (and it is fairly easy to
  258. add more), so you will have a lot of tools with which to poke around
  259. the system.
  260. There are a couple of other ways to log in:
  261. +o On a virtual console
  262. Each virtual console that is configured (i.e. the device exists in
  263. /dev and /etc/inittab runs a getty on it) will come up in its own
  264. xterm. If you get tired of the xterms, read ``Setting up serial
  265. lines and consoles'' to see how to attach the consoles to
  266. something else, like host ptys.
  267. +o Over the serial line
  268. In the boot output, find a line that looks like:
  269. serial line 0 assigned pty /dev/ptyp1
  270. Attach your favorite terminal program to the corresponding tty. I.e.
  271. for minicom, the command would be
  272. host% minicom -o -p /dev/ttyp1
  273. +o Over the net
  274. If the network is running, then you can telnet to the virtual
  275. machine and log in to it. See ``Setting up the network'' to learn
  276. about setting up a virtual network.
  277. When you're done using it, run halt, and the kernel will bring itself
  278. down and the process will exit.
  279. 33..33.. EExxaammpplleess
  280. Here are some examples of UML in action:
  281. +o A login session <http://user-mode-linux.sourceforge.net/login.html>
  282. +o A virtual network <http://user-mode-linux.sourceforge.net/net.html>
  283. 44.. UUMMLL oonn 22GG//22GG hhoossttss
  284. 44..11.. IInnttrroodduuccttiioonn
  285. Most Linux machines are configured so that the kernel occupies the
  286. upper 1G (0xc0000000 - 0xffffffff) of the 4G address space and
  287. processes use the lower 3G (0x00000000 - 0xbfffffff). However, some
  288. machine are configured with a 2G/2G split, with the kernel occupying
  289. the upper 2G (0x80000000 - 0xffffffff) and processes using the lower
  290. 2G (0x00000000 - 0x7fffffff).
  291. 44..22.. TThhee pprroobblleemm
  292. The prebuilt UML binaries on this site will not run on 2G/2G hosts
  293. because UML occupies the upper .5G of the 3G process address space
  294. (0xa0000000 - 0xbfffffff). Obviously, on 2G/2G hosts, this is right
  295. in the middle of the kernel address space, so UML won't even load - it
  296. will immediately segfault.
  297. 44..33.. TThhee ssoolluuttiioonn
  298. The fix for this is to rebuild UML from source after enabling
  299. CONFIG_HOST_2G_2G (under 'General Setup'). This will cause UML to
  300. load itself in the top .5G of that smaller process address space,
  301. where it will run fine. See ``Compiling the kernel and modules'' if
  302. you need help building UML from source.
  303. 55.. SSeettttiinngg uupp sseerriiaall lliinneess aanndd ccoonnssoolleess
  304. It is possible to attach UML serial lines and consoles to many types
  305. of host I/O channels by specifying them on the command line.
  306. You can attach them to host ptys, ttys, file descriptors, and ports.
  307. This allows you to do things like
  308. +o have a UML console appear on an unused host console,
  309. +o hook two virtual machines together by having one attach to a pty
  310. and having the other attach to the corresponding tty
  311. +o make a virtual machine accessible from the net by attaching a
  312. console to a port on the host.
  313. The general format of the command line option is device=channel.
  314. 55..11.. SSppeecciiffyyiinngg tthhee ddeevviiccee
  315. Devices are specified with "con" or "ssl" (console or serial line,
  316. respectively), optionally with a device number if you are talking
  317. about a specific device.
  318. Using just "con" or "ssl" describes all of the consoles or serial
  319. lines. If you want to talk about console #3 or serial line #10, they
  320. would be "con3" and "ssl10", respectively.
  321. A specific device name will override a less general "con=" or "ssl=".
  322. So, for example, you can assign a pty to each of the serial lines
  323. except for the first two like this:
  324. ssl=pty ssl0=tty:/dev/tty0 ssl1=tty:/dev/tty1
  325. The specificity of the device name is all that matters; order on the
  326. command line is irrelevant.
  327. 55..22.. SSppeecciiffyyiinngg tthhee cchhaannnneell
  328. There are a number of different types of channels to attach a UML
  329. device to, each with a different way of specifying exactly what to
  330. attach to.
  331. +o pseudo-terminals - device=pty pts terminals - device=pts
  332. This will cause UML to allocate a free host pseudo-terminal for the
  333. device. The terminal that it got will be announced in the boot
  334. log. You access it by attaching a terminal program to the
  335. corresponding tty:
  336. +o screen /dev/pts/n
  337. +o screen /dev/ttyxx
  338. +o minicom -o -p /dev/ttyxx - minicom seems not able to handle pts
  339. devices
  340. +o kermit - start it up, 'open' the device, then 'connect'
  341. +o terminals - device=tty:tty device file
  342. This will make UML attach the device to the specified tty (i.e
  343. con1=tty:/dev/tty3
  344. will attach UML's console 1 to the host's /dev/tty3). If the tty that
  345. you specify is the slave end of a tty/pty pair, something else must
  346. have already opened the corresponding pty in order for this to work.
  347. +o xterms - device=xterm
  348. UML will run an xterm and the device will be attached to it.
  349. +o Port - device=port:port number
  350. This will attach the UML devices to the specified host port.
  351. Attaching console 1 to the host's port 9000 would be done like
  352. this:
  353. con1=port:9000
  354. Attaching all the serial lines to that port would be done similarly:
  355. ssl=port:9000
  356. You access these devices by telnetting to that port. Each active tel-
  357. net session gets a different device. If there are more telnets to a
  358. port than UML devices attached to it, then the extra telnet sessions
  359. will block until an existing telnet detaches, or until another device
  360. becomes active (i.e. by being activated in /etc/inittab).
  361. This channel has the advantage that you can both attach multiple UML
  362. devices to it and know how to access them without reading the UML boot
  363. log. It is also unique in allowing access to a UML from remote
  364. machines without requiring that the UML be networked. This could be
  365. useful in allowing public access to UMLs because they would be
  366. accessible from the net, but wouldn't need any kind of network
  367. filtering or access control because they would have no network access.
  368. If you attach the main console to a portal, then the UML boot will
  369. appear to hang. In reality, it's waiting for a telnet to connect, at
  370. which point the boot will proceed.
  371. +o already-existing file descriptors - device=file descriptor
  372. If you set up a file descriptor on the UML command line, you can
  373. attach a UML device to it. This is most commonly used to put the
  374. main console back on stdin and stdout after assigning all the other
  375. consoles to something else:
  376. con0=fd:0,fd:1 con=pts
  377. +o Nothing - device=null
  378. This allows the device to be opened, in contrast to 'none', but
  379. reads will block, and writes will succeed and the data will be
  380. thrown out.
  381. +o None - device=none
  382. This causes the device to disappear.
  383. You can also specify different input and output channels for a device
  384. by putting a comma between them:
  385. ssl3=tty:/dev/tty2,xterm
  386. will cause serial line 3 to accept input on the host's /dev/tty3 and
  387. display output on an xterm. That's a silly example - the most common
  388. use of this syntax is to reattach the main console to stdin and stdout
  389. as shown above.
  390. If you decide to move the main console away from stdin/stdout, the
  391. initial boot output will appear in the terminal that you're running
  392. UML in. However, once the console driver has been officially
  393. initialized, then the boot output will start appearing wherever you
  394. specified that console 0 should be. That device will receive all
  395. subsequent output.
  396. 55..33.. EExxaammpplleess
  397. There are a number of interesting things you can do with this
  398. capability.
  399. First, this is how you get rid of those bleeding console xterms by
  400. attaching them to host ptys:
  401. con=pty con0=fd:0,fd:1
  402. This will make a UML console take over an unused host virtual console,
  403. so that when you switch to it, you will see the UML login prompt
  404. rather than the host login prompt:
  405. con1=tty:/dev/tty6
  406. You can attach two virtual machines together with what amounts to a
  407. serial line as follows:
  408. Run one UML with a serial line attached to a pty -
  409. ssl1=pty
  410. Look at the boot log to see what pty it got (this example will assume
  411. that it got /dev/ptyp1).
  412. Boot the other UML with a serial line attached to the corresponding
  413. tty -
  414. ssl1=tty:/dev/ttyp1
  415. Log in, make sure that it has no getty on that serial line, attach a
  416. terminal program like minicom to it, and you should see the login
  417. prompt of the other virtual machine.
  418. 66.. SSeettttiinngg uupp tthhee nneettwwoorrkk
  419. This page describes how to set up the various transports and to
  420. provide a UML instance with network access to the host, other machines
  421. on the local net, and the rest of the net.
  422. As of 2.4.5, UML networking has been completely redone to make it much
  423. easier to set up, fix bugs, and add new features.
  424. There is a new helper, uml_net, which does the host setup that
  425. requires root privileges.
  426. There are currently five transport types available for a UML virtual
  427. machine to exchange packets with other hosts:
  428. +o ethertap
  429. +o TUN/TAP
  430. +o Multicast
  431. +o a switch daemon
  432. +o slip
  433. +o slirp
  434. +o pcap
  435. The TUN/TAP, ethertap, slip, and slirp transports allow a UML
  436. instance to exchange packets with the host. They may be directed
  437. to the host or the host may just act as a router to provide access
  438. to other physical or virtual machines.
  439. The pcap transport is a synthetic read-only interface, using the
  440. libpcap binary to collect packets from interfaces on the host and
  441. filter them. This is useful for building preconfigured traffic
  442. monitors or sniffers.
  443. The daemon and multicast transports provide a completely virtual
  444. network to other virtual machines. This network is completely
  445. disconnected from the physical network unless one of the virtual
  446. machines on it is acting as a gateway.
  447. With so many host transports, which one should you use? Here's when
  448. you should use each one:
  449. +o ethertap - if you want access to the host networking and it is
  450. running 2.2
  451. +o TUN/TAP - if you want access to the host networking and it is
  452. running 2.4. Also, the TUN/TAP transport is able to use a
  453. preconfigured device, allowing it to avoid using the setuid uml_net
  454. helper, which is a security advantage.
  455. +o Multicast - if you want a purely virtual network and you don't want
  456. to set up anything but the UML
  457. +o a switch daemon - if you want a purely virtual network and you
  458. don't mind running the daemon in order to get somewhat better
  459. performance
  460. +o slip - there is no particular reason to run the slip backend unless
  461. ethertap and TUN/TAP are just not available for some reason
  462. +o slirp - if you don't have root access on the host to setup
  463. networking, or if you don't want to allocate an IP to your UML
  464. +o pcap - not much use for actual network connectivity, but great for
  465. monitoring traffic on the host
  466. Ethertap is available on 2.4 and works fine. TUN/TAP is preferred
  467. to it because it has better performance and ethertap is officially
  468. considered obsolete in 2.4. Also, the root helper only needs to
  469. run occasionally for TUN/TAP, rather than handling every packet, as
  470. it does with ethertap. This is a slight security advantage since
  471. it provides fewer opportunities for a nasty UML user to somehow
  472. exploit the helper's root privileges.
  473. 66..11.. GGeenneerraall sseettuupp
  474. First, you must have the virtual network enabled in your UML. If are
  475. running a prebuilt kernel from this site, everything is already
  476. enabled. If you build the kernel yourself, under the "Network device
  477. support" menu, enable "Network device support", and then the three
  478. transports.
  479. The next step is to provide a network device to the virtual machine.
  480. This is done by describing it on the kernel command line.
  481. The general format is
  482. eth <n> = <transport> , <transport args>
  483. For example, a virtual ethernet device may be attached to a host
  484. ethertap device as follows:
  485. eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254
  486. This sets up eth0 inside the virtual machine to attach itself to the
  487. host /dev/tap0, assigns it an ethernet address, and assigns the host
  488. tap0 interface an IP address.
  489. Note that the IP address you assign to the host end of the tap device
  490. must be different than the IP you assign to the eth device inside UML.
  491. If you are short on IPs and don't want to consume two per UML, then
  492. you can reuse the host's eth IP address for the host ends of the tap
  493. devices. Internally, the UMLs must still get unique IPs for their eth
  494. devices. You can also give the UMLs non-routable IPs (192.168.x.x or
  495. 10.x.x.x) and have the host masquerade them. This will let outgoing
  496. connections work, but incoming connections won't without more work,
  497. such as port forwarding from the host.
  498. Also note that when you configure the host side of an interface, it is
  499. only acting as a gateway. It will respond to pings sent to it
  500. locally, but is not useful to do that since it's a host interface.
  501. You are not talking to the UML when you ping that interface and get a
  502. response.
  503. You can also add devices to a UML and remove them at runtime. See the
  504. ``The Management Console'' page for details.
  505. The sections below describe this in more detail.
  506. Once you've decided how you're going to set up the devices, you boot
  507. UML, log in, configure the UML side of the devices, and set up routes
  508. to the outside world. At that point, you will be able to talk to any
  509. other machines, physical or virtual, on the net.
  510. If ifconfig inside UML fails and the network refuses to come up, run
  511. tell you what went wrong.
  512. 66..22.. UUsseerrssppaaccee ddaaeemmoonnss
  513. You will likely need the setuid helper, or the switch daemon, or both.
  514. They are both installed with the RPM and deb, so if you've installed
  515. either, you can skip the rest of this section.
  516. If not, then you need to check them out of CVS, build them, and
  517. install them. The helper is uml_net, in CVS /tools/uml_net, and the
  518. daemon is uml_switch, in CVS /tools/uml_router. They are both built
  519. with a plain 'make'. Both need to be installed in a directory that's
  520. in your path - /usr/bin is recommend. On top of that, uml_net needs
  521. to be setuid root.
  522. 66..33.. SSppeecciiffyyiinngg eetthheerrnneett aaddddrreesssseess
  523. Below, you will see that the TUN/TAP, ethertap, and daemon interfaces
  524. allow you to specify hardware addresses for the virtual ethernet
  525. devices. This is generally not necessary. If you don't have a
  526. specific reason to do it, you probably shouldn't. If one is not
  527. specified on the command line, the driver will assign one based on the
  528. device IP address. It will provide the address fe:fd:nn:nn:nn:nn
  529. where nn.nn.nn.nn is the device IP address. This is nearly always
  530. sufficient to guarantee a unique hardware address for the device. A
  531. couple of exceptions are:
  532. +o Another set of virtual ethernet devices are on the same network and
  533. they are assigned hardware addresses using a different scheme which
  534. may conflict with the UML IP address-based scheme
  535. +o You aren't going to use the device for IP networking, so you don't
  536. assign the device an IP address
  537. If you let the driver provide the hardware address, you should make
  538. sure that the device IP address is known before the interface is
  539. brought up. So, inside UML, this will guarantee that:
  540. UML#
  541. ifconfig eth0 192.168.0.250 up
  542. If you decide to assign the hardware address yourself, make sure that
  543. the first byte of the address is even. Addresses with an odd first
  544. byte are broadcast addresses, which you don't want assigned to a
  545. device.
  546. 66..44.. UUMMLL iinntteerrffaaccee sseettuupp
  547. Once the network devices have been described on the command line, you
  548. should boot UML and log in.
  549. The first thing to do is bring the interface up:
  550. UML# ifconfig ethn ip-address up
  551. You should be able to ping the host at this point.
  552. To reach the rest of the world, you should set a default route to the
  553. host:
  554. UML# route add default gw host ip
  555. Again, with host ip of 192.168.0.4:
  556. UML# route add default gw 192.168.0.4
  557. This page used to recommend setting a network route to your local net.
  558. This is wrong, because it will cause UML to try to figure out hardware
  559. addresses of the local machines by arping on the interface to the
  560. host. Since that interface is basically a single strand of ethernet
  561. with two nodes on it (UML and the host) and arp requests don't cross
  562. networks, they will fail to elicit any responses. So, what you want
  563. is for UML to just blindly throw all packets at the host and let it
  564. figure out what to do with them, which is what leaving out the network
  565. route and adding the default route does.
  566. Note: If you can't communicate with other hosts on your physical
  567. ethernet, it's probably because of a network route that's
  568. automatically set up. If you run 'route -n' and see a route that
  569. looks like this:
  570. Destination Gateway Genmask Flags Metric Ref Use Iface
  571. 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
  572. with a mask that's not 255.255.255.255, then replace it with a route
  573. to your host:
  574. UML#
  575. route del -net 192.168.0.0 dev eth0 netmask 255.255.255.0
  576. UML#
  577. route add -host 192.168.0.4 dev eth0
  578. This, plus the default route to the host, will allow UML to exchange
  579. packets with any machine on your ethernet.
  580. 66..55.. MMuullttiiccaasstt
  581. The simplest way to set up a virtual network between multiple UMLs is
  582. to use the mcast transport. This was written by Harald Welte and is
  583. present in UML version 2.4.5-5um and later. Your system must have
  584. multicast enabled in the kernel and there must be a multicast-capable
  585. network device on the host. Normally, this is eth0, but if there is
  586. no ethernet card on the host, then you will likely get strange error
  587. messages when you bring the device up inside UML.
  588. To use it, run two UMLs with
  589. eth0=mcast
  590. on their command lines. Log in, configure the ethernet device in each
  591. machine with different IP addresses:
  592. UML1# ifconfig eth0 192.168.0.254
  593. UML2# ifconfig eth0 192.168.0.253
  594. and they should be able to talk to each other.
  595. The full set of command line options for this transport are
  596. ethn=mcast,ethernet address,multicast
  597. address,multicast port,ttl
  598. Harald's original README is here <http://user-mode-linux.source-
  599. forge.net/text/mcast.txt> and explains these in detail, as well as
  600. some other issues.
  601. 66..66.. TTUUNN//TTAAPP wwiitthh tthhee uummll__nneett hheellppeerr
  602. TUN/TAP is the preferred mechanism on 2.4 to exchange packets with the
  603. host. The TUN/TAP backend has been in UML since 2.4.9-3um.
  604. The easiest way to get up and running is to let the setuid uml_net
  605. helper do the host setup for you. This involves insmod-ing the tun.o
  606. module if necessary, configuring the device, and setting up IP
  607. forwarding, routing, and proxy arp. If you are new to UML networking,
  608. do this first. If you're concerned about the security implications of
  609. the setuid helper, use it to get up and running, then read the next
  610. section to see how to have UML use a preconfigured tap device, which
  611. avoids the use of uml_net.
  612. If you specify an IP address for the host side of the device, the
  613. uml_net helper will do all necessary setup on the host - the only
  614. requirement is that TUN/TAP be available, either built in to the host
  615. kernel or as the tun.o module.
  616. The format of the command line switch to attach a device to a TUN/TAP
  617. device is
  618. eth <n> =tuntap,,, <IP address>
  619. For example, this argument will attach the UML's eth0 to the next
  620. available tap device and assign an ethernet address to it based on its
  621. IP address
  622. eth0=tuntap,,,192.168.0.254
  623. Note that the IP address that must be used for the eth device inside
  624. UML is fixed by the routing and proxy arp that is set up on the
  625. TUN/TAP device on the host. You can use a different one, but it won't
  626. work because reply packets won't reach the UML. This is a feature.
  627. It prevents a nasty UML user from doing things like setting the UML IP
  628. to the same as the network's nameserver or mail server.
  629. There are a couple potential problems with running the TUN/TAP
  630. transport on a 2.4 host kernel
  631. +o TUN/TAP seems not to work on 2.4.3 and earlier. Upgrade the host
  632. kernel or use the ethertap transport.
  633. +o With an upgraded kernel, TUN/TAP may fail with
  634. File descriptor in bad state
  635. This is due to a header mismatch between the upgraded kernel and the
  636. kernel that was originally installed on the machine. The fix is to
  637. make sure that /usr/src/linux points to the headers for the running
  638. kernel.
  639. These were pointed out by Tim Robinson <timro at trkr dot net> in
  640. <http://www.geocrawler.com/lists/3/SourceForge/597/0/> name="this uml-
  641. user post"> .
  642. 66..77.. TTUUNN//TTAAPP wwiitthh aa pprreeccoonnffiigguurreedd ttaapp ddeevviiccee
  643. If you prefer not to have UML use uml_net (which is somewhat
  644. insecure), with UML 2.4.17-11, you can set up a TUN/TAP device
  645. beforehand. The setup needs to be done as root, but once that's done,
  646. there is no need for root assistance. Setting up the device is done
  647. as follows:
  648. +o Create the device with tunctl (available from the UML utilities
  649. tarball)
  650. host# tunctl -u uid
  651. where uid is the user id or username that UML will be run as. This
  652. will tell you what device was created.
  653. +o Configure the device IP (change IP addresses and device name to
  654. suit)
  655. host# ifconfig tap0 192.168.0.254 up
  656. +o Set up routing and arping if desired - this is my recipe, there are
  657. other ways of doing the same thing
  658. host#
  659. bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
  660. host#
  661. route add -host 192.168.0.253 dev tap0
  662. host#
  663. bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'
  664. host#
  665. arp -Ds 192.168.0.253 eth0 pub
  666. Note that this must be done every time the host boots - this configu-
  667. ration is not stored across host reboots. So, it's probably a good
  668. idea to stick it in an rc file. An even better idea would be a little
  669. utility which reads the information from a config file and sets up
  670. devices at boot time.
  671. +o Rather than using up two IPs and ARPing for one of them, you can
  672. also provide direct access to your LAN by the UML by using a
  673. bridge.
  674. host#
  675. brctl addbr br0
  676. host#
  677. ifconfig eth0 0.0.0.0 promisc up
  678. host#
  679. ifconfig tap0 0.0.0.0 promisc up
  680. host#
  681. ifconfig br0 192.168.0.1 netmask 255.255.255.0 up
  682. host#
  683. brctl stp br0 off
  684. host#
  685. brctl setfd br0 1
  686. host#
  687. brctl sethello br0 1
  688. host#
  689. brctl addif br0 eth0
  690. host#
  691. brctl addif br0 tap0
  692. Note that 'br0' should be setup using ifconfig with the existing IP
  693. address of eth0, as eth0 no longer has its own IP.
  694. +o
  695. Also, the /dev/net/tun device must be writable by the user running
  696. UML in order for the UML to use the device that's been configured
  697. for it. The simplest thing to do is
  698. host# chmod 666 /dev/net/tun
  699. Making it world-writable looks bad, but it seems not to be
  700. exploitable as a security hole. However, it does allow anyone to cre-
  701. ate useless tap devices (useless because they can't configure them),
  702. which is a DOS attack. A somewhat more secure alternative would to be
  703. to create a group containing all the users who have preconfigured tap
  704. devices and chgrp /dev/net/tun to that group with mode 664 or 660.
  705. +o Once the device is set up, run UML with 'eth0=tuntap,device name'
  706. (i.e. 'eth0=tuntap,tap0') on the command line (or do it with the
  707. mconsole config command).
  708. +o Bring the eth device up in UML and you're in business.
  709. If you don't want that tap device any more, you can make it non-
  710. persistent with
  711. host# tunctl -d tap device
  712. Finally, tunctl has a -b (for brief mode) switch which causes it to
  713. output only the name of the tap device it created. This makes it
  714. suitable for capture by a script:
  715. host# TAP=`tunctl -u 1000 -b`
  716. 66..88.. EEtthheerrttaapp
  717. Ethertap is the general mechanism on 2.2 for userspace processes to
  718. exchange packets with the kernel.
  719. To use this transport, you need to describe the virtual network device
  720. on the UML command line. The general format for this is
  721. eth <n> =ethertap, <device> , <ethernet address> , <tap IP address>
  722. So, the previous example
  723. eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254
  724. attaches the UML eth0 device to the host /dev/tap0, assigns it the
  725. ethernet address fe:fd:0:0:0:1, and assigns the IP address
  726. 192.168.0.254 to the tap device.
  727. The tap device is mandatory, but the others are optional. If the
  728. ethernet address is omitted, one will be assigned to it.
  729. The presence of the tap IP address will cause the helper to run and do
  730. whatever host setup is needed to allow the virtual machine to
  731. communicate with the outside world. If you're not sure you know what
  732. you're doing, this is the way to go.
  733. If it is absent, then you must configure the tap device and whatever
  734. arping and routing you will need on the host. However, even in this
  735. case, the uml_net helper still needs to be in your path and it must be
  736. setuid root if you're not running UML as root. This is because the
  737. tap device doesn't support SIGIO, which UML needs in order to use
  738. something as a source of input. So, the helper is used as a
  739. convenient asynchronous IO thread.
  740. If you're using the uml_net helper, you can ignore the following host
  741. setup - uml_net will do it for you. You just need to make sure you
  742. have ethertap available, either built in to the host kernel or
  743. available as a module.
  744. If you want to set things up yourself, you need to make sure that the
  745. appropriate /dev entry exists. If it doesn't, become root and create
  746. it as follows:
  747. mknod /dev/tap <minor> c 36 <minor> + 16
  748. For example, this is how to create /dev/tap0:
  749. mknod /dev/tap0 c 36 0 + 16
  750. You also need to make sure that the host kernel has ethertap support.
  751. If ethertap is enabled as a module, you apparently need to insmod
  752. ethertap once for each ethertap device you want to enable. So,
  753. host#
  754. insmod ethertap
  755. will give you the tap0 interface. To get the tap1 interface, you need
  756. to run
  757. host#
  758. insmod ethertap unit=1 -o ethertap1
  759. 66..99.. TThhee sswwiittcchh ddaaeemmoonn
  760. NNoottee: This is the daemon formerly known as uml_router, but which was
  761. renamed so the network weenies of the world would stop growling at me.
  762. The switch daemon, uml_switch, provides a mechanism for creating a
  763. totally virtual network. By default, it provides no connection to the
  764. host network (but see -tap, below).
  765. The first thing you need to do is run the daemon. Running it with no
  766. arguments will make it listen on a default pair of unix domain
  767. sockets.
  768. If you want it to listen on a different pair of sockets, use
  769. -unix control socket data socket
  770. If you want it to act as a hub rather than a switch, use
  771. -hub
  772. If you want the switch to be connected to host networking (allowing
  773. the umls to get access to the outside world through the host), use
  774. -tap tap0
  775. Note that the tap device must be preconfigured (see "TUN/TAP with a
  776. preconfigured tap device", above). If you're using a different tap
  777. device than tap0, specify that instead of tap0.
  778. uml_switch can be backgrounded as follows
  779. host%
  780. uml_switch [ options ] < /dev/null > /dev/null
  781. The reason it doesn't background by default is that it listens to
  782. stdin for EOF. When it sees that, it exits.
  783. The general format of the kernel command line switch is
  784. ethn=daemon,ethernet address,socket
  785. type,control socket,data socket
  786. You can leave off everything except the 'daemon'. You only need to
  787. specify the ethernet address if the one that will be assigned to it
  788. isn't acceptable for some reason. The rest of the arguments describe
  789. how to communicate with the daemon. You should only specify them if
  790. you told the daemon to use different sockets than the default. So, if
  791. you ran the daemon with no arguments, running the UML on the same
  792. machine with
  793. eth0=daemon
  794. will cause the eth0 driver to attach itself to the daemon correctly.
  795. 66..1100.. SSlliipp
  796. Slip is another, less general, mechanism for a process to communicate
  797. with the host networking. In contrast to the ethertap interface,
  798. which exchanges ethernet frames with the host and can be used to
  799. transport any higher-level protocol, it can only be used to transport
  800. IP.
  801. The general format of the command line switch is
  802. ethn=slip,slip IP
  803. The slip IP argument is the IP address that will be assigned to the
  804. host end of the slip device. If it is specified, the helper will run
  805. and will set up the host so that the virtual machine can reach it and
  806. the rest of the network.
  807. There are some oddities with this interface that you should be aware
  808. of. You should only specify one slip device on a given virtual
  809. machine, and its name inside UML will be 'umn', not 'eth0' or whatever
  810. you specified on the command line. These problems will be fixed at
  811. some point.
  812. 66..1111.. SSlliirrpp
  813. slirp uses an external program, usually /usr/bin/slirp, to provide IP
  814. only networking connectivity through the host. This is similar to IP
  815. masquerading with a firewall, although the translation is performed in
  816. user-space, rather than by the kernel. As slirp does not set up any
  817. interfaces on the host, or changes routing, slirp does not require
  818. root access or setuid binaries on the host.
  819. The general format of the command line switch for slirp is:
  820. ethn=slirp,ethernet address,slirp path
  821. The ethernet address is optional, as UML will set up the interface
  822. with an ethernet address based upon the initial IP address of the
  823. interface. The slirp path is generally /usr/bin/slirp, although it
  824. will depend on distribution.
  825. The slirp program can have a number of options passed to the command
  826. line and we can't add them to the UML command line, as they will be
  827. parsed incorrectly. Instead, a wrapper shell script can be written or
  828. the options inserted into the /.slirprc file. More information on
  829. all of the slirp options can be found in its man pages.
  830. The eth0 interface on UML should be set up with the IP 10.2.0.15,
  831. although you can use anything as long as it is not used by a network
  832. you will be connecting to. The default route on UML should be set to
  833. use
  834. UML#
  835. route add default dev eth0
  836. slirp provides a number of useful IP addresses which can be used by
  837. UML, such as 10.0.2.3 which is an alias for the DNS server specified
  838. in /etc/resolv.conf on the host or the IP given in the 'dns' option
  839. for slirp.
  840. Even with a baudrate setting higher than 115200, the slirp connection
  841. is limited to 115200. If you need it to go faster, the slirp binary
  842. needs to be compiled with FULL_BOLT defined in config.h.
  843. 66..1122.. ppccaapp
  844. The pcap transport is attached to a UML ethernet device on the command
  845. line or with uml_mconsole with the following syntax:
  846. ethn=pcap,host interface,filter
  847. expression,option1,option2
  848. The expression and options are optional.
  849. The interface is whatever network device on the host you want to
  850. sniff. The expression is a pcap filter expression, which is also what
  851. tcpdump uses, so if you know how to specify tcpdump filters, you will
  852. use the same expressions here. The options are up to two of
  853. 'promisc', control whether pcap puts the host interface into
  854. promiscuous mode. 'optimize' and 'nooptimize' control whether the pcap
  855. expression optimizer is used.
  856. Example:
  857. eth0=pcap,eth0,tcp
  858. eth1=pcap,eth0,!tcp
  859. will cause the UML eth0 to emit all tcp packets on the host eth0 and
  860. the UML eth1 to emit all non-tcp packets on the host eth0.
  861. 66..1133.. SSeettttiinngg uupp tthhee hhoosstt yyoouurrsseellff
  862. If you don't specify an address for the host side of the ethertap or
  863. slip device, UML won't do any setup on the host. So this is what is
  864. needed to get things working (the examples use a host-side IP of
  865. 192.168.0.251 and a UML-side IP of 192.168.0.250 - adjust to suit your
  866. own network):
  867. +o The device needs to be configured with its IP address. Tap devices
  868. are also configured with an mtu of 1484. Slip devices are
  869. configured with a point-to-point address pointing at the UML ip
  870. address.
  871. host# ifconfig tap0 arp mtu 1484 192.168.0.251 up
  872. host#
  873. ifconfig sl0 192.168.0.251 pointopoint 192.168.0.250 up
  874. +o If a tap device is being set up, a route is set to the UML IP.
  875. UML# route add -host 192.168.0.250 gw 192.168.0.251
  876. +o To allow other hosts on your network to see the virtual machine,
  877. proxy arp is set up for it.
  878. host# arp -Ds 192.168.0.250 eth0 pub
  879. +o Finally, the host is set up to route packets.
  880. host# echo 1 > /proc/sys/net/ipv4/ip_forward
  881. 77.. SShhaarriinngg FFiilleessyysstteemmss bbeettwweeeenn VViirrttuuaall MMaacchhiinneess
  882. 77..11.. AA wwaarrnniinngg
  883. Don't attempt to share filesystems simply by booting two UMLs from the
  884. same file. That's the same thing as booting two physical machines
  885. from a shared disk. It will result in filesystem corruption.
  886. 77..22.. UUssiinngg llaayyeerreedd bblloocckk ddeevviicceess
  887. The way to share a filesystem between two virtual machines is to use
  888. the copy-on-write (COW) layering capability of the ubd block driver.
  889. As of 2.4.6-2um, the driver supports layering a read-write private
  890. device over a read-only shared device. A machine's writes are stored
  891. in the private device, while reads come from either device - the
  892. private one if the requested block is valid in it, the shared one if
  893. not. Using this scheme, the majority of data which is unchanged is
  894. shared between an arbitrary number of virtual machines, each of which
  895. has a much smaller file containing the changes that it has made. With
  896. a large number of UMLs booting from a large root filesystem, this
  897. leads to a huge disk space saving. It will also help performance,
  898. since the host will be able to cache the shared data using a much
  899. smaller amount of memory, so UML disk requests will be served from the
  900. host's memory rather than its disks.
  901. To add a copy-on-write layer to an existing block device file, simply
  902. add the name of the COW file to the appropriate ubd switch:
  903. ubd0=root_fs_cow,root_fs_debian_22
  904. where 'root_fs_cow' is the private COW file and 'root_fs_debian_22' is
  905. the existing shared filesystem. The COW file need not exist. If it
  906. doesn't, the driver will create and initialize it. Once the COW file
  907. has been initialized, it can be used on its own on the command line:
  908. ubd0=root_fs_cow
  909. The name of the backing file is stored in the COW file header, so it
  910. would be redundant to continue specifying it on the command line.
  911. 77..33.. NNoottee!!
  912. When checking the size of the COW file in order to see the gobs of
  913. space that you're saving, make sure you use 'ls -ls' to see the actual
  914. disk consumption rather than the length of the file. The COW file is
  915. sparse, so the length will be very different from the disk usage.
  916. Here is a 'ls -l' of a COW file and backing file from one boot and
  917. shutdown:
  918. host% ls -l cow.debian debian2.2
  919. -rw-r--r-- 1 jdike jdike 492504064 Aug 6 21:16 cow.debian
  920. -rwxrw-rw- 1 jdike jdike 537919488 Aug 6 20:42 debian2.2
  921. Doesn't look like much saved space, does it? Well, here's 'ls -ls':
  922. host% ls -ls cow.debian debian2.2
  923. 880 -rw-r--r-- 1 jdike jdike 492504064 Aug 6 21:16 cow.debian
  924. 525832 -rwxrw-rw- 1 jdike jdike 537919488 Aug 6 20:42 debian2.2
  925. Now, you can see that the COW file has less than a meg of disk, rather
  926. than 492 meg.
  927. 77..44.. AAnnootthheerr wwaarrnniinngg
  928. Once a filesystem is being used as a readonly backing file for a COW
  929. file, do not boot directly from it or modify it in any way. Doing so
  930. will invalidate any COW files that are using it. The mtime and size
  931. of the backing file are stored in the COW file header at its creation,
  932. and they must continue to match. If they don't, the driver will
  933. refuse to use the COW file.
  934. If you attempt to evade this restriction by changing either the
  935. backing file or the COW header by hand, you will get a corrupted
  936. filesystem.
  937. Among other things, this means that upgrading the distribution in a
  938. backing file and expecting that all of the COW files using it will see
  939. the upgrade will not work.
  940. 77..55.. uummll__mmoooo :: MMeerrggiinngg aa CCOOWW ffiillee wwiitthh iittss bbaacckkiinngg ffiillee
  941. Depending on how you use UML and COW devices, it may be advisable to
  942. merge the changes in the COW file into the backing file every once in
  943. a while.
  944. The utility that does this is uml_moo. Its usage is
  945. host% uml_moo COW file new backing file
  946. There's no need to specify the backing file since that information is
  947. already in the COW file header. If you're paranoid, boot the new
  948. merged file, and if you're happy with it, move it over the old backing
  949. file.
  950. uml_moo creates a new backing file by default as a safety measure. It
  951. also has a destructive merge option which will merge the COW file
  952. directly into its current backing file. This is really only usable
  953. when the backing file only has one COW file associated with it. If
  954. there are multiple COWs associated with a backing file, a -d merge of
  955. one of them will invalidate all of the others. However, it is
  956. convenient if you're short of disk space, and it should also be
  957. noticeably faster than a non-destructive merge.
  958. uml_moo is installed with the UML deb and RPM. If you didn't install
  959. UML from one of those packages, you can also get it from the UML
  960. utilities <http://user-mode-linux.sourceforge.net/dl-sf.html#UML
  961. utilities> tar file in tools/moo.
  962. 88.. CCrreeaattiinngg ffiilleessyysstteemmss
  963. You may want to create and mount new UML filesystems, either because
  964. your root filesystem isn't large enough or because you want to use a
  965. filesystem other than ext2.
  966. This was written on the occasion of reiserfs being included in the
  967. 2.4.1 kernel pool, and therefore the 2.4.1 UML, so the examples will
  968. talk about reiserfs. This information is generic, and the examples
  969. should be easy to translate to the filesystem of your choice.
  970. 88..11.. CCrreeaattee tthhee ffiilleessyysstteemm ffiillee
  971. dd is your friend. All you need to do is tell dd to create an empty
  972. file of the appropriate size. I usually make it sparse to save time
  973. and to avoid allocating disk space until it's actually used. For
  974. example, the following command will create a sparse 100 meg file full
  975. of zeroes.
  976. host%
  977. dd if=/dev/zero of=new_filesystem seek=100 count=1 bs=1M
  978. 88..22.. AAssssiiggnn tthhee ffiillee ttoo aa UUMMLL ddeevviiccee
  979. Add an argument like the following to the UML command line:
  980. ubd4=new_filesystem
  981. making sure that you use an unassigned ubd device number.
  982. 88..33.. CCrreeaattiinngg aanndd mmoouunnttiinngg tthhee ffiilleessyysstteemm
  983. Make sure that the filesystem is available, either by being built into
  984. the kernel, or available as a module, then boot up UML and log in. If
  985. the root filesystem doesn't have the filesystem utilities (mkfs, fsck,
  986. etc), then get them into UML by way of the net or hostfs.
  987. Make the new filesystem on the device assigned to the new file:
  988. host# mkreiserfs /dev/ubd/4
  989. <----------- MKREISERFSv2 ----------->
  990. ReiserFS version 3.6.25
  991. Block size 4096 bytes
  992. Block count 25856
  993. Used blocks 8212
  994. Journal - 8192 blocks (18-8209), journal header is in block 8210
  995. Bitmaps: 17
  996. Root block 8211
  997. Hash function "r5"
  998. ATTENTION: ALL DATA WILL BE LOST ON '/dev/ubd/4'! (y/n)y
  999. journal size 8192 (from 18)
  1000. Initializing journal - 0%....20%....40%....60%....80%....100%
  1001. Syncing..done.
  1002. Now, mount it:
  1003. UML#
  1004. mount /dev/ubd/4 /mnt
  1005. and you're in business.
  1006. 99.. HHoosstt ffiillee aacccceessss
  1007. If you want to access files on the host machine from inside UML, you
  1008. can treat it as a separate machine and either nfs mount directories
  1009. from the host or copy files into the virtual machine with scp or rcp.
  1010. However, since UML is running on the host, it can access those
  1011. files just like any other process and make them available inside the
  1012. virtual machine without needing to use the network.
  1013. This is now possible with the hostfs virtual filesystem. With it, you
  1014. can mount a host directory into the UML filesystem and access the
  1015. files contained in it just as you would on the host.
  1016. 99..11.. UUssiinngg hhoossttffss
  1017. To begin with, make sure that hostfs is available inside the virtual
  1018. machine with
  1019. UML# cat /proc/filesystems
  1020. . hostfs should be listed. If it's not, either rebuild the kernel
  1021. with hostfs configured into it or make sure that hostfs is built as a
  1022. module and available inside the virtual machine, and insmod it.
  1023. Now all you need to do is run mount:
  1024. UML# mount none /mnt/host -t hostfs
  1025. will mount the host's / on the virtual machine's /mnt/host.
  1026. If you don't want to mount the host root directory, then you can
  1027. specify a subdirectory to mount with the -o switch to mount:
  1028. UML# mount none /mnt/home -t hostfs -o /home
  1029. will mount the hosts's /home on the virtual machine's /mnt/home.
  1030. 99..22.. hhoossttffss aass tthhee rroooott ffiilleessyysstteemm
  1031. It's possible to boot from a directory hierarchy on the host using
  1032. hostfs rather than using the standard filesystem in a file.
  1033. To start, you need that hierarchy. The easiest way is to loop mount
  1034. an existing root_fs file:
  1035. host# mount root_fs uml_root_dir -o loop
  1036. You need to change the filesystem type of / in etc/fstab to be
  1037. 'hostfs', so that line looks like this:
  1038. /dev/ubd/0 / hostfs defaults 1 1
  1039. Then you need to chown to yourself all the files in that directory
  1040. that are owned by root. This worked for me:
  1041. host# find . -uid 0 -exec chown jdike {} \;
  1042. Next, make sure that your UML kernel has hostfs compiled in, not as a
  1043. module. Then run UML with the boot device pointing at that directory:
  1044. ubd0=/path/to/uml/root/directory
  1045. UML should then boot as it does normally.
  1046. 99..33.. BBuuiillddiinngg hhoossttffss
  1047. If you need to build hostfs because it's not in your kernel, you have
  1048. two choices:
  1049. +o Compiling hostfs into the kernel:
  1050. Reconfigure the kernel and set the 'Host filesystem' option under
  1051. +o Compiling hostfs as a module:
  1052. Reconfigure the kernel and set the 'Host filesystem' option under
  1053. be in arch/um/fs/hostfs/hostfs.o. Install that in
  1054. /lib/modules/`uname -r`/fs in the virtual machine, boot it up, and
  1055. UML# insmod hostfs
  1056. 1100.. TThhee MMaannaaggeemmeenntt CCoonnssoollee
  1057. The UML management console is a low-level interface to the kernel,
  1058. somewhat like the i386 SysRq interface. Since there is a full-blown
  1059. operating system under UML, there is much greater flexibility possible
  1060. than with the SysRq mechanism.
  1061. There are a number of things you can do with the mconsole interface:
  1062. +o get the kernel version
  1063. +o add and remove devices
  1064. +o halt or reboot the machine
  1065. +o Send SysRq commands
  1066. +o Pause and resume the UML
  1067. You need the mconsole client (uml_mconsole) which is present in CVS
  1068. (/tools/mconsole) in 2.4.5-9um and later, and will be in the RPM in
  1069. 2.4.6.
  1070. You also need CONFIG_MCONSOLE (under 'General Setup') enabled in UML.
  1071. When you boot UML, you'll see a line like:
  1072. mconsole initialized on /home/jdike/.uml/umlNJ32yL/mconsole
  1073. If you specify a unique machine id one the UML command line, i.e.
  1074. umid=debian
  1075. you'll see this
  1076. mconsole initialized on /home/jdike/.uml/debian/mconsole
  1077. That file is the socket that uml_mconsole will use to communicate with
  1078. UML. Run it with either the umid or the full path as its argument:
  1079. host% uml_mconsole debian
  1080. or
  1081. host% uml_mconsole /home/jdike/.uml/debian/mconsole
  1082. You'll get a prompt, at which you can run one of these commands:
  1083. +o version
  1084. +o halt
  1085. +o reboot
  1086. +o config
  1087. +o remove
  1088. +o sysrq
  1089. +o help
  1090. +o cad
  1091. +o stop
  1092. +o go
  1093. 1100..11.. vveerrssiioonn
  1094. This takes no arguments. It prints the UML version.
  1095. (mconsole) version
  1096. OK Linux usermode 2.4.5-9um #1 Wed Jun 20 22:47:08 EDT 2001 i686
  1097. There are a couple actual uses for this. It's a simple no-op which
  1098. can be used to check that a UML is running. It's also a way of
  1099. sending an interrupt to the UML. This is sometimes useful on SMP
  1100. hosts, where there's a bug which causes signals to UML to be lost,
  1101. often causing it to appear to hang. Sending such a UML the mconsole
  1102. version command is a good way to 'wake it up' before networking has
  1103. been enabled, as it does not do anything to the function of the UML.
  1104. 1100..22.. hhaalltt aanndd rreebboooott
  1105. These take no arguments. They shut the machine down immediately, with
  1106. no syncing of disks and no clean shutdown of userspace. So, they are
  1107. pretty close to crashing the machine.
  1108. (mconsole) halt
  1109. OK
  1110. 1100..33.. ccoonnffiigg
  1111. "config" adds a new device to the virtual machine. Currently the ubd
  1112. and network drivers support this. It takes one argument, which is the
  1113. device to add, with the same syntax as the kernel command line.
  1114. (mconsole)
  1115. config ubd3=/home/jdike/incoming/roots/root_fs_debian22
  1116. OK
  1117. (mconsole) config eth1=mcast
  1118. OK
  1119. 1100..44.. rreemmoovvee
  1120. "remove" deletes a device from the system. Its argument is just the
  1121. name of the device to be removed. The device must be idle in whatever
  1122. sense the driver considers necessary. In the case of the ubd driver,
  1123. the removed block device must not be mounted, swapped on, or otherwise
  1124. open, and in the case of the network driver, the device must be down.
  1125. (mconsole) remove ubd3
  1126. OK
  1127. (mconsole) remove eth1
  1128. OK
  1129. 1100..55.. ssyyssrrqq
  1130. This takes one argument, which is a single letter. It calls the
  1131. generic kernel's SysRq driver, which does whatever is called for by
  1132. that argument. See the SysRq documentation in Documentation/sysrq.txt
  1133. in your favorite kernel tree to see what letters are valid and what
  1134. they do.
  1135. 1100..66.. hheellpp
  1136. "help" returns a string listing the valid commands and what each one
  1137. does.
  1138. 1100..77.. ccaadd
  1139. This invokes the Ctl-Alt-Del action on init. What exactly this ends
  1140. up doing is up to /etc/inittab. Normally, it reboots the machine.
  1141. With UML, this is usually not desired, so if a halt would be better,
  1142. then find the section of inittab that looks like this
  1143. # What to do when CTRL-ALT-DEL is pressed.
  1144. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
  1145. and change the command to halt.
  1146. 1100..88.. ssttoopp
  1147. This puts the UML in a loop reading mconsole requests until a 'go'
  1148. mconsole command is received. This is very useful for making backups
  1149. of UML filesystems, as the UML can be stopped, then synced via 'sysrq
  1150. s', so that everything is written to the filesystem. You can then copy
  1151. the filesystem and then send the UML 'go' via mconsole.
  1152. Note that a UML running with more than one CPU will have problems
  1153. after you send the 'stop' command, as only one CPU will be held in a
  1154. mconsole loop and all others will continue as normal. This is a bug,
  1155. and will be fixed.
  1156. 1100..99.. ggoo
  1157. This resumes a UML after being paused by a 'stop' command. Note that
  1158. when the UML has resumed, TCP connections may have timed out and if
  1159. the UML is paused for a long period of time, crond might go a little
  1160. crazy, running all the jobs it didn't do earlier.
  1161. 1111.. KKeerrnneell ddeebbuuggggiinngg
  1162. NNoottee:: The interface that makes debugging, as described here, possible
  1163. is present in 2.4.0-test6 kernels and later.
  1164. Since the user-mode kernel runs as a normal Linux process, it is
  1165. possible to debug it with gdb almost like any other process. It is
  1166. slightly different because the kernel's threads are already being
  1167. ptraced for system call interception, so gdb can't ptrace them.
  1168. However, a mechanism has been added to work around that problem.
  1169. In order to debug the kernel, you need build it from source. See
  1170. ``Compiling the kernel and modules'' for information on doing that.
  1171. Make sure that you enable CONFIG_DEBUGSYM and CONFIG_PT_PROXY during
  1172. the config. These will compile the kernel with -g, and enable the
  1173. ptrace proxy so that gdb works with UML, respectively.
  1174. 1111..11.. SSttaarrttiinngg tthhee kkeerrnneell uunnddeerr ggddbb
  1175. You can have the kernel running under the control of gdb from the
  1176. beginning by putting 'debug' on the command line. You will get an
  1177. xterm with gdb running inside it. The kernel will send some commands
  1178. to gdb which will leave it stopped at the beginning of start_kernel.
  1179. At this point, you can get things going with 'next', 'step', or
  1180. 'cont'.
  1181. There is a transcript of a debugging session here <debug-
  1182. session.html> , with breakpoints being set in the scheduler and in an
  1183. interrupt handler.
  1184. 1111..22.. EExxaammiinniinngg sslleeeeppiinngg pprroocceesssseess
  1185. Not every bug is evident in the currently running process. Sometimes,
  1186. processes hang in the kernel when they shouldn't because they've
  1187. deadlocked on a semaphore or something similar. In this case, when
  1188. you ^C gdb and get a backtrace, you will see the idle thread, which
  1189. isn't very relevant.
  1190. What you want is the stack of whatever process is sleeping when it
  1191. shouldn't be. You need to figure out which process that is, which is
  1192. generally fairly easy. Then you need to get its host process id,
  1193. which you can do either by looking at ps on the host or at
  1194. task.thread.extern_pid in gdb.
  1195. Now what you do is this:
  1196. +o detach from the current thread
  1197. (UML gdb) det
  1198. +o attach to the thread you are interested in
  1199. (UML gdb) att <host pid>
  1200. +o look at its stack and anything else of interest
  1201. (UML gdb) bt
  1202. Note that you can't do anything at this point that requires that a
  1203. process execute, e.g. calling a function
  1204. +o when you're done looking at that process, reattach to the current
  1205. thread and continue it
  1206. (UML gdb)
  1207. att 1
  1208. (UML gdb)
  1209. c
  1210. Here, specifying any pid which is not the process id of a UML thread
  1211. will cause gdb to reattach to the current thread. I commonly use 1,
  1212. but any other invalid pid would work.
  1213. 1111..33.. RRuunnnniinngg dddddd oonn UUMMLL
  1214. ddd works on UML, but requires a special kludge. The process goes
  1215. like this:
  1216. +o Start ddd
  1217. host% ddd linux
  1218. +o With ps, get the pid of the gdb that ddd started. You can ask the
  1219. gdb to tell you, but for some reason that confuses things and
  1220. causes a hang.
  1221. +o run UML with 'debug=parent gdb-pid=<pid>' added to the command line
  1222. - it will just sit there after you hit return
  1223. +o type 'att 1' to the ddd gdb and you will see something like
  1224. 0xa013dc51 in __kill ()
  1225. (gdb)
  1226. +o At this point, type 'c', UML will boot up, and you can use ddd just
  1227. as you do on any other process.
  1228. 1111..44.. DDeebbuuggggiinngg mmoodduulleess
  1229. gdb has support for debugging code which is dynamically loaded into
  1230. the process. This support is what is needed to debug kernel modules
  1231. under UML.
  1232. Using that support is somewhat complicated. You have to tell gdb what
  1233. object file you just loaded into UML and where in memory it is. Then,
  1234. it can read the symbol table, and figure out where all the symbols are
  1235. from the load address that you provided. It gets more interesting
  1236. when you load the module again (i.e. after an rmmod). You have to
  1237. tell gdb to forget about all its symbols, including the main UML ones
  1238. for some reason, then load then all back in again.
  1239. There's an easy way and a hard way to do this. The easy way is to use
  1240. the umlgdb expect script written by Chandan Kudige. It basically
  1241. automates the process for you.
  1242. First, you must tell it where your modules are. There is a list in
  1243. the script that looks like this:
  1244. set MODULE_PATHS {
  1245. "fat" "/usr/src/uml/linux-2.4.18/fs/fat/fat.o"
  1246. "isofs" "/usr/src/uml/linux-2.4.18/fs/isofs/isofs.o"
  1247. "minix" "/usr/src/uml/linux-2.4.18/fs/minix/minix.o"
  1248. }
  1249. You change that to list the names and paths of the modules that you
  1250. are going to debug. Then you run it from the toplevel directory of
  1251. your UML pool and it basically tells you what to do:
  1252. ******** GDB pid is 21903 ********
  1253. Start UML as: ./linux <kernel switches> debug gdb-pid=21903
  1254. GNU gdb 5.0rh-5 Red Hat Linux 7.1
  1255. Copyright 2001 Free Software Foundation, Inc.
  1256. GDB is free software, covered by the GNU General Public License, and you are
  1257. welcome to change it and/or distribute copies of it under certain conditions.
  1258. Type "show copying" to see the conditions.
  1259. There is absolutely no warranty for GDB. Type "show warranty" for details.
  1260. This GDB was configured as "i386-redhat-linux"...
  1261. (gdb) b sys_init_module
  1262. Breakpoint 1 at 0xa0011923: file module.c, line 349.
  1263. (gdb) att 1
  1264. After you run UML and it sits there doing nothing, you hit return at
  1265. the 'att 1' and continue it:
  1266. Attaching to program: /home/jdike/linux/2.4/um/./linux, process 1
  1267. 0xa00f4221 in __kill ()
  1268. (UML gdb) c
  1269. Continuing.
  1270. At this point, you debug normally. When you insmod something, the
  1271. expect magic will kick in and you'll see something like:
  1272. *** Module hostfs loaded ***
  1273. Breakpoint 1, sys_init_module (name_user=0x805abb0 "hostfs",
  1274. mod_user=0x8070e00) at module.c:349
  1275. 349 char *name, *n_name, *name_tmp = NULL;
  1276. (UML gdb) finish
  1277. Run till exit from #0 sys_init_module (name_user=0x805abb0 "hostfs",
  1278. mod_user=0x8070e00) at module.c:349
  1279. 0xa00e2e23 in execute_syscall (r=0xa8140284) at syscall_kern.c:411
  1280. 411 else res = EXECUTE_SYSCALL(syscall, regs);
  1281. Value returned is $1 = 0
  1282. (UML gdb)
  1283. p/x (int)module_list + module_list->size_of_struct
  1284. $2 = 0xa9021054
  1285. (UML gdb) symbol-file ./linux
  1286. Load new symbol table from "./linux"? (y or n) y
  1287. Reading symbols from ./linux...
  1288. done.
  1289. (UML gdb)
  1290. add-symbol-file /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o 0xa9021054
  1291. add symbol table from file "/home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o" at
  1292. .text_addr = 0xa9021054
  1293. (y or n) y
  1294. Reading symbols from /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o...
  1295. done.
  1296. (UML gdb) p *module_list
  1297. $1 = {size_of_struct = 84, next = 0xa0178720, name = 0xa9022de0 "hostfs",
  1298. size = 9016, uc = {usecount = {counter = 0}, pad = 0}, flags = 1,
  1299. nsyms = 57, ndeps = 0, syms = 0xa9023170, deps = 0x0, refs = 0x0,
  1300. init = 0xa90221f0 <init_hostfs>, cleanup = 0xa902222c <exit_hostfs>,
  1301. ex_table_start = 0x0, ex_table_end = 0x0, persist_start = 0x0,
  1302. persist_end = 0x0, can_unload = 0, runsize = 0, kallsyms_start = 0x0,
  1303. kallsyms_end = 0x0,
  1304. archdata_start = 0x1b855 <Address 0x1b855 out of bounds>,
  1305. archdata_end = 0xe5890000 <Address 0xe5890000 out of bounds>,
  1306. kernel_data = 0xf689c35d <Address 0xf689c35d out of bounds>}
  1307. >> Finished loading symbols for hostfs ...
  1308. That's the easy way. It's highly recommended. The hard way is
  1309. described below in case you're interested in what's going on.
  1310. Boot the kernel under the debugger and load the module with insmod or
  1311. modprobe. With gdb, do:
  1312. (UML gdb) p module_list
  1313. This is a list of modules that have been loaded into the kernel, with
  1314. the most recently loaded module first. Normally, the module you want
  1315. is at module_list. If it's not, walk down the next links, looking at
  1316. the name fields until find the module you want to debug. Take the
  1317. address of that structure, and add module.size_of_struct (which in
  1318. 2.4.10 kernels is 96 (0x60)) to it. Gdb can make this hard addition
  1319. for you :-):
  1320. (UML gdb)
  1321. printf "%#x\n", (int)module_list module_list->size_of_struct
  1322. The offset from the module start occasionally changes (before 2.4.0,
  1323. it was module.size_of_struct + 4), so it's a good idea to check the
  1324. init and cleanup addresses once in a while, as describe below. Now
  1325. do:
  1326. (UML gdb)
  1327. add-symbol-file /path/to/module/on/host that_address
  1328. Tell gdb you really want to do it, and you're in business.
  1329. If there's any doubt that you got the offset right, like breakpoints
  1330. appear not to work, or they're appearing in the wrong place, you can
  1331. check it by looking at the module structure. The init and cleanup
  1332. fields should look like:
  1333. init = 0x588066b0 <init_hostfs>, cleanup = 0x588066c0 <exit_hostfs>
  1334. with no offsets on the symbol names. If the names are right, but they
  1335. are offset, then the offset tells you how much you need to add to the
  1336. address you gave to add-symbol-file.
  1337. When you want to load in a new version of the module, you need to get
  1338. gdb to forget about the old one. The only way I've found to do that
  1339. is to tell gdb to forget about all symbols that it knows about:
  1340. (UML gdb) symbol-file
  1341. Then reload the symbols from the kernel binary:
  1342. (UML gdb) symbol-file /path/to/kernel
  1343. and repeat the process above. You'll also need to re-enable break-
  1344. points. They were disabled when you dumped all the symbols because
  1345. gdb couldn't figure out where they should go.
  1346. 1111..55.. AAttttaacchhiinngg ggddbb ttoo tthhee kkeerrnneell
  1347. If you don't have the kernel running under gdb, you can attach gdb to
  1348. it later by sending the tracing thread a SIGUSR1. The first line of
  1349. the console output identifies its pid:
  1350. tracing thread pid = 20093
  1351. When you send it the signal:
  1352. host% kill -USR1 20093
  1353. you will get an xterm with gdb running in it.
  1354. If you have the mconsole compiled into UML, then the mconsole client
  1355. can be used to start gdb:
  1356. (mconsole) (mconsole) config gdb=xterm
  1357. will fire up an xterm with gdb running in it.
  1358. 1111..66.. UUssiinngg aalltteerrnnaattee ddeebbuuggggeerrss
  1359. UML has support for attaching to an already running debugger rather
  1360. than starting gdb itself. This is present in CVS as of 17 Apr 2001.
  1361. I sent it to Alan for inclusion in the ac tree, and it will be in my
  1362. 2.4.4 release.
  1363. This is useful when gdb is a subprocess of some UI, such as emacs or
  1364. ddd. It can also be used to run debuggers other than gdb on UML.
  1365. Below is an example of using strace as an alternate debugger.
  1366. To do this, you need to get the pid of the debugger and pass it in
  1367. with the
  1368. If you are using gdb under some UI, then tell it to 'att 1', and
  1369. you'll find yourself attached to UML.
  1370. If you are using something other than gdb as your debugger, then
  1371. you'll need to get it to do the equivalent of 'att 1' if it doesn't do
  1372. it automatically.
  1373. An example of an alternate debugger is strace. You can strace the
  1374. actual kernel as follows:
  1375. +o Run the following in a shell
  1376. host%
  1377. sh -c 'echo pid=$$; echo -n hit return; read x; exec strace -p 1 -o strace.out'
  1378. +o Run UML with 'debug' and 'gdb-pid=<pid>' with the pid printed out
  1379. by the previous command
  1380. +o Hit return in the shell, and UML will start running, and strace
  1381. output will start accumulating in the output file.
  1382. Note that this is different from running
  1383. host% strace ./linux
  1384. That will strace only the main UML thread, the tracing thread, which
  1385. doesn't do any of the actual kernel work. It just oversees the vir-
  1386. tual machine. In contrast, using strace as described above will show
  1387. you the low-level activity of the virtual machine.
  1388. 1122.. KKeerrnneell ddeebbuuggggiinngg eexxaammpplleess
  1389. 1122..11.. TThhee ccaassee ooff tthhee hhuunngg ffsscckk
  1390. When booting up the kernel, fsck failed, and dropped me into a shell
  1391. to fix things up. I ran fsck -y, which hung:
  1392. Setting hostname uml [ OK ]
  1393. Checking root filesystem
  1394. /dev/fhd0 was not cleanly unmounted, check forced.
  1395. Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780.
  1396. /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
  1397. (i.e., without -a or -p options)
  1398. [ FAILED ]
  1399. *** An error occurred during the file system check.
  1400. *** Dropping you to a shell; the system will reboot
  1401. *** when you leave the shell.
  1402. Give root password for maintenance
  1403. (or type Control-D for normal startup):
  1404. [root@uml /root]# fsck -y /dev/fhd0
  1405. fsck -y /dev/fhd0
  1406. Parallelizing fsck version 1.14 (9-Jan-1999)
  1407. e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09
  1408. /dev/fhd0 contains a file system with errors, check forced.
  1409. Pass 1: Checking inodes, blocks, and sizes
  1410. Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes
  1411. Inode 19780, i_blocks is 1548, should be 540. Fix? yes
  1412. Pass 2: Checking directory structure
  1413. Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes
  1414. Directory inode 11858, block 0, offset 0: directory corrupted
  1415. Salvage? yes
  1416. Missing '.' in directory inode 11858.
  1417. Fix? yes
  1418. Missing '..' in directory inode 11858.
  1419. Fix? yes
  1420. The standard drill in this sort of situation is to fire up gdb on the
  1421. signal thread, which, in this case, was pid 1935. In another window,
  1422. I run gdb and attach pid 1935.
  1423. ~/linux/2.3.26/um 1016: gdb linux
  1424. GNU gdb 4.17.0.11 with Linux support
  1425. Copyright 1998 Free Software Foundation, Inc.
  1426. GDB is free software, covered by the GNU General Public License, and you are
  1427. welcome to change it and/or distribute copies of it under certain conditions.
  1428. Type "show copying" to see the conditions.
  1429. There is absolutely no warranty for GDB. Type "show warranty" for details.
  1430. This GDB was configured as "i386-redhat-linux"...
  1431. (gdb) att 1935
  1432. Attaching to program `/home/dike/linux/2.3.26/um/linux', Pid 1935
  1433. 0x100756d9 in __wait4 ()
  1434. Let's see what's currently running:
  1435. (gdb) p current_task.pid
  1436. $1 = 0
  1437. It's the idle thread, which means that fsck went to sleep for some
  1438. reason and never woke up.
  1439. Let's guess that the last process in the process list is fsck:
  1440. (gdb) p current_task.prev_task.comm
  1441. $13 = "fsck.ext2\000\000\000\000\000\000"
  1442. It is, so let's see what it thinks it's up to:
  1443. (gdb) p current_task.prev_task.thread
  1444. $14 = {extern_pid = 1980, tracing = 0, want_tracing = 0, forking = 0,
  1445. kernel_stack_page = 0, signal_stack = 1342627840, syscall = {id = 4, args = {
  1446. 3, 134973440, 1024, 0, 1024}, have_result = 0, result = 50590720},
  1447. request = {op = 2, u = {exec = {ip = 1350467584, sp = 2952789424}, fork = {
  1448. regs = {1350467584, 2952789424, 0 <repeats 15 times>}, sigstack = 0,
  1449. pid = 0}, switch_to = 0x507e8000, thread = {proc = 0x507e8000,
  1450. arg = 0xaffffdb0, flags = 0, new_pid = 0}, input_request = {
  1451. op = 1350467584, fd = -1342177872, proc = 0, pid = 0}}}}
  1452. The interesting things here are the fact that its .thread.syscall.id
  1453. is __NR_write (see the big switch in arch/um/kernel/syscall_kern.c or
  1454. the defines in include/asm-um/arch/unistd.h), and that it never
  1455. returned. Also, its .request.op is OP_SWITCH (see
  1456. arch/um/include/user_util.h). These mean that it went into a write,
  1457. and, for some reason, called schedule().
  1458. The fact that it never returned from write means that its stack should
  1459. be fairly interesting. Its pid is 1980 (.thread.extern_pid). That
  1460. process is being ptraced by the signal thread, so it must be detached
  1461. before gdb can attach it:
  1462. (gdb) call detach(1980)
  1463. Program received signal SIGSEGV, Segmentation fault.
  1464. <function called from gdb>
  1465. The program being debugged stopped while in a function called from GDB.
  1466. When the function (detach) is done executing, GDB will silently
  1467. stop (instead of continuing to evaluate the expression containing
  1468. the function call).
  1469. (gdb) call detach(1980)
  1470. $15 = 0
  1471. The first detach segfaults for some reason, and the second one
  1472. succeeds.
  1473. Now I detach from the signal thread, attach to the fsck thread, and
  1474. look at its stack:
  1475. (gdb) det
  1476. Detaching from program: /home/dike/linux/2.3.26/um/linux Pid 1935
  1477. (gdb) att 1980
  1478. Attaching to program `/home/dike/linux/2.3.26/um/linux', Pid 1980
  1479. 0x10070451 in __kill ()
  1480. (gdb) bt
  1481. #0 0x10070451 in __kill ()
  1482. #1 0x10068ccd in usr1_pid (pid=1980) at process.c:30
  1483. #2 0x1006a03f in _switch_to (prev=0x50072000, next=0x507e8000)
  1484. at process_kern.c:156
  1485. #3 0x1006a052 in switch_to (prev=0x50072000, next=0x507e8000, last=0x50072000)
  1486. at process_kern.c:161
  1487. #4 0x10001d12 in schedule () at sched.c:777
  1488. #5 0x1006a744 in __down (sem=0x507d241c) at semaphore.c:71
  1489. #6 0x1006aa10 in __down_failed () at semaphore.c:157
  1490. #7 0x1006c5d8 in segv_handler (sc=0x5006e940) at trap_user.c:174
  1491. #8 0x1006c5ec in kern_segv_handler (sig=11) at trap_user.c:182
  1492. #9 <signal handler called>
  1493. #10 0x10155404 in errno ()
  1494. #11 0x1006c0aa in segv (address=1342179328, is_write=2) at trap_kern.c:50
  1495. #12 0x1006c5d8 in segv_handler (sc=0x5006eaf8) at trap_user.c:174
  1496. #13 0x1006c5ec in kern_segv_handler (sig=11) at trap_user.c:182
  1497. #14 <signal handler called>
  1498. #15 0xc0fd in ?? ()
  1499. #16 0x10016647 in sys_write (fd=3,
  1500. buf=0x80b8800 <Address 0x80b8800 out of bounds>, count=1024)
  1501. at read_write.c:159
  1502. #17 0x1006d5b3 in execute_syscall (syscall=4, args=0x5006ef08)
  1503. at syscall_kern.c:254
  1504. #18 0x1006af87 in really_do_syscall (sig=12) at syscall_user.c:35
  1505. #19 <signal handler called>
  1506. #20 0x400dc8b0 in ?? ()
  1507. The interesting things here are :
  1508. +o There are two segfaults on this stack (frames 9 and 14)
  1509. +o The first faulting address (frame 11) is 0x50000800
  1510. (gdb) p (void *)1342179328
  1511. $16 = (void *) 0x50000800
  1512. The initial faulting address is interesting because it is on the idle
  1513. thread's stack. I had been seeing the idle thread segfault for no
  1514. apparent reason, and the cause looked like stack corruption. In hopes
  1515. of catching the culprit in the act, I had turned off all protections
  1516. to that stack while the idle thread wasn't running. This apparently
  1517. tripped that trap.
  1518. However, the more immediate problem is that second segfault and I'm
  1519. going to concentrate on that. First, I want to see where the fault
  1520. happened, so I have to go look at the sigcontent struct in frame 8:
  1521. (gdb) up
  1522. #1 0x10068ccd in usr1_pid (pid=1980) at process.c:30
  1523. 30 kill(pid, SIGUSR1);
  1524. (gdb)
  1525. #2 0x1006a03f in _switch_to (prev=0x50072000, next=0x507e8000)
  1526. at process_kern.c:156
  1527. 156 usr1_pid(getpid());
  1528. (gdb)
  1529. #3 0x1006a052 in switch_to (prev=0x50072000, next=0x507e8000, last=0x50072000)
  1530. at process_kern.c:161
  1531. 161 _switch_to(prev, next);
  1532. (gdb)
  1533. #4 0x10001d12 in schedule () at sched.c:777
  1534. 777 switch_to(prev, next, prev);
  1535. (gdb)
  1536. #5 0x1006a744 in __down (sem=0x507d241c) at semaphore.c:71
  1537. 71 schedule();
  1538. (gdb)
  1539. #6 0x1006aa10 in __down_failed () at semaphore.c:157
  1540. 157 }
  1541. (gdb)
  1542. #7 0x1006c5d8 in segv_handler (sc=0x5006e940) at trap_user.c:174
  1543. 174 segv(sc->cr2, sc->err & 2);
  1544. (gdb)
  1545. #8 0x1006c5ec in kern_segv_handler (sig=11) at trap_user.c:182
  1546. 182 segv_handler(sc);
  1547. (gdb) p *sc
  1548. Cannot access memory at address 0x0.
  1549. That's not very useful, so I'll try a more manual method:
  1550. (gdb) p *((struct sigcontext *) (&sig + 1))
  1551. $19 = {gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43,
  1552. __dsh = 0, edi = 1342179328, esi = 1350378548, ebp = 1342630440,
  1553. esp = 1342630420, ebx = 1348150624, edx = 1280, ecx = 0, eax = 0,
  1554. trapno = 14, err = 4, eip = 268480945, cs = 35, __csh = 0, eflags = 66118,
  1555. esp_at_signal = 1342630420, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 0,
  1556. cr2 = 1280}
  1557. The ip is in handle_mm_fault:
  1558. (gdb) p (void *)268480945
  1559. $20 = (void *) 0x1000b1b1
  1560. (gdb) i sym $20
  1561. handle_mm_fault + 57 in section .text
  1562. Specifically, it's in pte_alloc:
  1563. (gdb) i line *$20
  1564. Line 124 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1565. starts at address 0x1000b1b1 <handle_mm_fault+57>
  1566. and ends at 0x1000b1b7 <handle_mm_fault+63>.
  1567. To find where in handle_mm_fault this is, I'll jump forward in the
  1568. code until I see an address in that procedure:
  1569. (gdb) i line *0x1000b1c0
  1570. Line 126 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1571. starts at address 0x1000b1b7 <handle_mm_fault+63>
  1572. and ends at 0x1000b1c3 <handle_mm_fault+75>.
  1573. (gdb) i line *0x1000b1d0
  1574. Line 131 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1575. starts at address 0x1000b1d0 <handle_mm_fault+88>
  1576. and ends at 0x1000b1da <handle_mm_fault+98>.
  1577. (gdb) i line *0x1000b1e0
  1578. Line 61 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1579. starts at address 0x1000b1da <handle_mm_fault+98>
  1580. and ends at 0x1000b1e1 <handle_mm_fault+105>.
  1581. (gdb) i line *0x1000b1f0
  1582. Line 134 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1583. starts at address 0x1000b1f0 <handle_mm_fault+120>
  1584. and ends at 0x1000b200 <handle_mm_fault+136>.
  1585. (gdb) i line *0x1000b200
  1586. Line 135 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1587. starts at address 0x1000b200 <handle_mm_fault+136>
  1588. and ends at 0x1000b208 <handle_mm_fault+144>.
  1589. (gdb) i line *0x1000b210
  1590. Line 139 of "/home/dike/linux/2.3.26/um/include/asm/pgalloc.h"
  1591. starts at address 0x1000b210 <handle_mm_fault+152>
  1592. and ends at 0x1000b219 <handle_mm_fault+161>.
  1593. (gdb) i line *0x1000b220
  1594. Line 1168 of "memory.c" starts at address 0x1000b21e <handle_mm_fault+166>
  1595. and ends at 0x1000b222 <handle_mm_fault+170>.
  1596. Something is apparently wrong with the page tables or vma_structs, so
  1597. lets go back to frame 11 and have a look at them:
  1598. #11 0x1006c0aa in segv (address=1342179328, is_write=2) at trap_kern.c:50
  1599. 50 handle_mm_fault(current, vma, address, is_write);
  1600. (gdb) call pgd_offset_proc(vma->vm_mm, address)
  1601. $22 = (pgd_t *) 0x80a548c
  1602. That's pretty bogus. Page tables aren't supposed to be in process
  1603. text or data areas. Let's see what's in the vma:
  1604. (gdb) p *vma
  1605. $23 = {vm_mm = 0x507d2434, vm_start = 0, vm_end = 134512640,
  1606. vm_next = 0x80a4f8c, vm_page_prot = {pgprot = 0}, vm_flags = 31200,
  1607. vm_avl_height = 2058, vm_avl_left = 0x80a8c94, vm_avl_right = 0x80d1000,
  1608. vm_next_share = 0xaffffdb0, vm_pprev_share = 0xaffffe63,
  1609. vm_ops = 0xaffffe7a, vm_pgoff = 2952789626, vm_file = 0xafffffec,
  1610. vm_private_data = 0x62}
  1611. (gdb) p *vma.vm_mm
  1612. $24 = {mmap = 0x507d2434, mmap_avl = 0x0, mmap_cache = 0x8048000,
  1613. pgd = 0x80a4f8c, mm_users = {counter = 0}, mm_count = {counter = 134904288},
  1614. map_count = 134909076, mmap_sem = {count = {counter = 135073792},
  1615. sleepers = -1342177872, wait = {lock = <optimized out or zero length>,
  1616. task_list = {next = 0xaffffe63, prev = 0xaffffe7a},
  1617. __magic = -1342177670, __creator = -1342177300}, __magic = 98},
  1618. page_table_lock = {}, context = 138, start_code = 0, end_code = 0,
  1619. start_data = 0, end_data = 0, start_brk = 0, brk = 0, start_stack = 0,
  1620. arg_start = 0, arg_end = 0, env_start = 0, env_end = 0, rss = 1350381536,
  1621. total_vm = 0, locked_vm = 0, def_flags = 0, cpu_vm_mask = 0, swap_cnt = 0,
  1622. swap_address = 0, segments = 0x0}
  1623. This also pretty bogus. With all of the 0x80xxxxx and 0xaffffxxx
  1624. addresses, this is looking like a stack was plonked down on top of
  1625. these structures. Maybe it's a stack overflow from the next page:
  1626. (gdb) p vma
  1627. $25 = (struct vm_area_struct *) 0x507d2434
  1628. That's towards the lower quarter of the page, so that would have to
  1629. have been pretty heavy stack overflow:
  1630. (gdb) x/100x $25
  1631. 0x507d2434: 0x507d2434 0x00000000 0x08048000 0x080a4f8c
  1632. 0x507d2444: 0x00000000 0x080a79e0 0x080a8c94 0x080d1000
  1633. 0x507d2454: 0xaffffdb0 0xaffffe63 0xaffffe7a 0xaffffe7a
  1634. 0x507d2464: 0xafffffec 0x00000062 0x0000008a 0x00000000
  1635. 0x507d2474: 0x00000000 0x00000000 0x00000000 0x00000000
  1636. 0x507d2484: 0x00000000 0x00000000 0x00000000 0x00000000
  1637. 0x507d2494: 0x00000000 0x00000000 0x507d2fe0 0x00000000
  1638. 0x507d24a4: 0x00000000 0x00000000 0x00000000 0x00000000
  1639. 0x507d24b4: 0x00000000 0x00000000 0x00000000 0x00000000
  1640. 0x507d24c4: 0x00000000 0x00000000 0x00000000 0x00000000
  1641. 0x507d24d4: 0x00000000 0x00000000 0x00000000 0x00000000
  1642. 0x507d24e4: 0x00000000 0x00000000 0x00000000 0x00000000
  1643. 0x507d24f4: 0x00000000 0x00000000 0x00000000 0x00000000
  1644. 0x507d2504: 0x00000000 0x00000000 0x00000000 0x00000000
  1645. 0x507d2514: 0x00000000 0x00000000 0x00000000 0x00000000
  1646. 0x507d2524: 0x00000000 0x00000000 0x00000000 0x00000000
  1647. 0x507d2534: 0x00000000 0x00000000 0x507d25dc 0x00000000
  1648. 0x507d2544: 0x00000000 0x00000000 0x00000000 0x00000000
  1649. 0x507d2554: 0x00000000 0x00000000 0x00000000 0x00000000
  1650. 0x507d2564: 0x00000000 0x00000000 0x00000000 0x00000000
  1651. 0x507d2574: 0x00000000 0x00000000 0x00000000 0x00000000
  1652. 0x507d2584: 0x00000000 0x00000000 0x00000000 0x00000000
  1653. 0x507d2594: 0x00000000 0x00000000 0x00000000 0x00000000
  1654. 0x507d25a4: 0x00000000 0x00000000 0x00000000 0x00000000
  1655. 0x507d25b4: 0x00000000 0x00000000 0x00000000 0x00000000
  1656. It's not stack overflow. The only "stack-like" piece of this data is
  1657. the vma_struct itself.
  1658. At this point, I don't see any avenues to pursue, so I just have to
  1659. admit that I have no idea what's going on. What I will do, though, is
  1660. stick a trap on the segfault handler which will stop if it sees any
  1661. writes to the idle thread's stack. That was the thing that happened
  1662. first, and it may be that if I can catch it immediately, what's going
  1663. on will be somewhat clearer.
  1664. 1122..22.. EEppiissooddee 22:: TThhee ccaassee ooff tthhee hhuunngg ffsscckk
  1665. After setting a trap in the SEGV handler for accesses to the signal
  1666. thread's stack, I reran the kernel.
  1667. fsck hung again, this time by hitting the trap:
  1668. Setting hostname uml [ OK ]
  1669. Checking root filesystem
  1670. /dev/fhd0 contains a file system with errors, check forced.
  1671. Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780.
  1672. /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
  1673. (i.e., without -a or -p options)
  1674. [ FAILED ]
  1675. *** An error occurred during the file system check.
  1676. *** Dropping you to a shell; the system will reboot
  1677. *** when you leave the shell.
  1678. Give root password for maintenance
  1679. (or type Control-D for normal startup):
  1680. [root@uml /root]# fsck -y /dev/fhd0
  1681. fsck -y /dev/fhd0
  1682. Parallelizing fsck version 1.14 (9-Jan-1999)
  1683. e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09
  1684. /dev/fhd0 contains a file system with errors, check forced.
  1685. Pass 1: Checking inodes, blocks, and sizes
  1686. Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes
  1687. Pass 2: Checking directory structure
  1688. Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes
  1689. Directory inode 11858, block 0, offset 0: directory corrupted
  1690. Salvage? yes
  1691. Missing '.' in directory inode 11858.
  1692. Fix? yes
  1693. Missing '..' in directory inode 11858.
  1694. Fix? yes
  1695. Untested (4127) [100fe44c]: trap_kern.c line 31
  1696. I need to get the signal thread to detach from pid 4127 so that I can
  1697. attach to it with gdb. This is done by sending it a SIGUSR1, which is
  1698. caught by the signal thread, which detaches the process:
  1699. kill -USR1 4127
  1700. Now I can run gdb on it:
  1701. ~/linux/2.3.26/um 1034: gdb linux
  1702. GNU gdb 4.17.0.11 with Linux support
  1703. Copyright 1998 Free Software Foundation, Inc.
  1704. GDB is free software, covered by the GNU General Public License, and you are
  1705. welcome to change it and/or distribute copies of it under certain conditions.
  1706. Type "show copying" to see the conditions.
  1707. There is absolutely no warranty for GDB. Type "show warranty" for details.
  1708. This GDB was configured as "i386-redhat-linux"...
  1709. (gdb) att 4127
  1710. Attaching to program `/home/dike/linux/2.3.26/um/linux', Pid 4127
  1711. 0x10075891 in __libc_nanosleep ()
  1712. The backtrace shows that it was in a write and that the fault address
  1713. (address in frame 3) is 0x50000800, which is right in the middle of
  1714. the signal thread's stack page:
  1715. (gdb) bt
  1716. #0 0x10075891 in __libc_nanosleep ()
  1717. #1 0x1007584d in __sleep (seconds=1000000)
  1718. at ../sysdeps/unix/sysv/linux/sleep.c:78
  1719. #2 0x1006ce9a in stop () at user_util.c:191
  1720. #3 0x1006bf88 in segv (address=1342179328, is_write=2) at trap_kern.c:31
  1721. #4 0x1006c628 in segv_handler (sc=0x5006eaf8) at trap_user.c:174
  1722. #5 0x1006c63c in kern_segv_handler (sig=11) at trap_user.c:182
  1723. #6 <signal handler called>
  1724. #7 0xc0fd in ?? ()
  1725. #8 0x10016647 in sys_write (fd=3, buf=0x80b8800 "R.", count=1024)
  1726. at read_write.c:159
  1727. #9 0x1006d603 in execute_syscall (syscall=4, args=0x5006ef08)
  1728. at syscall_kern.c:254
  1729. #10 0x1006af87 in really_do_syscall (sig=12) at syscall_user.c:35
  1730. #11 <signal handler called>
  1731. #12 0x400dc8b0 in ?? ()
  1732. #13 <signal handler called>
  1733. #14 0x400dc8b0 in ?? ()
  1734. #15 0x80545fd in ?? ()
  1735. #16 0x804daae in ?? ()
  1736. #17 0x8054334 in ?? ()
  1737. #18 0x804d23e in ?? ()
  1738. #19 0x8049632 in ?? ()
  1739. #20 0x80491d2 in ?? ()
  1740. #21 0x80596b5 in ?? ()
  1741. (gdb) p (void *)1342179328
  1742. $3 = (void *) 0x50000800
  1743. Going up the stack to the segv_handler frame and looking at where in
  1744. the code the access happened shows that it happened near line 110 of
  1745. block_dev.c:
  1746. (gdb) up
  1747. #1 0x1007584d in __sleep (seconds=1000000)
  1748. at ../sysdeps/unix/sysv/linux/sleep.c:78
  1749. ../sysdeps/unix/sysv/linux/sleep.c:78: No such file or directory.
  1750. (gdb)
  1751. #2 0x1006ce9a in stop () at user_util.c:191
  1752. 191 while(1) sleep(1000000);
  1753. (gdb)
  1754. #3 0x1006bf88 in segv (address=1342179328, is_write=2) at trap_kern.c:31
  1755. 31 KERN_UNTESTED();
  1756. (gdb)
  1757. #4 0x1006c628 in segv_handler (sc=0x5006eaf8) at trap_user.c:174
  1758. 174 segv(sc->cr2, sc->err & 2);
  1759. (gdb) p *sc
  1760. $1 = {gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43,
  1761. __dsh = 0, edi = 1342179328, esi = 134973440, ebp = 1342631484,
  1762. esp = 1342630864, ebx = 256, edx = 0, ecx = 256, eax = 1024, trapno = 14,
  1763. err = 6, eip = 268550834, cs = 35, __csh = 0, eflags = 66070,
  1764. esp_at_signal = 1342630864, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 0,
  1765. cr2 = 1342179328}
  1766. (gdb) p (void *)268550834
  1767. $2 = (void *) 0x1001c2b2
  1768. (gdb) i sym $2
  1769. block_write + 1090 in section .text
  1770. (gdb) i line *$2
  1771. Line 209 of "/home/dike/linux/2.3.26/um/include/asm/arch/string.h"
  1772. starts at address 0x1001c2a1 <block_write+1073>
  1773. and ends at 0x1001c2bf <block_write+1103>.
  1774. (gdb) i line *0x1001c2c0
  1775. Line 110 of "block_dev.c" starts at address 0x1001c2bf <block_write+1103>
  1776. and ends at 0x1001c2e3 <block_write+1139>.
  1777. Looking at the source shows that the fault happened during a call to
  1778. copy_to_user to copy the data into the kernel:
  1779. 107 count -= chars;
  1780. 108 copy_from_user(p,buf,chars);
  1781. 109 p += chars;
  1782. 110 buf += chars;
  1783. p is the pointer which must contain 0x50000800, since buf contains
  1784. 0x80b8800 (frame 8 above). It is defined as:
  1785. p = offset + bh->b_data;
  1786. I need to figure out what bh is, and it just so happens that bh is
  1787. passed as an argument to mark_buffer_uptodate and mark_buffer_dirty a
  1788. few lines later, so I do a little disassembly:
  1789. (gdb) disas 0x1001c2bf 0x1001c2e0
  1790. Dump of assembler code from 0x1001c2bf to 0x1001c2d0:
  1791. 0x1001c2bf <block_write+1103>: addl %eax,0xc(%ebp)
  1792. 0x1001c2c2 <block_write+1106>: movl 0xfffffdd4(%ebp),%edx
  1793. 0x1001c2c8 <block_write+1112>: btsl $0x0,0x18(%edx)
  1794. 0x1001c2cd <block_write+1117>: btsl $0x1,0x18(%edx)
  1795. 0x1001c2d2 <block_write+1122>: sbbl %ecx,%ecx
  1796. 0x1001c2d4 <block_write+1124>: testl %ecx,%ecx
  1797. 0x1001c2d6 <block_write+1126>: jne 0x1001c2e3 <block_write+1139>
  1798. 0x1001c2d8 <block_write+1128>: pushl $0x0
  1799. 0x1001c2da <block_write+1130>: pushl %edx
  1800. 0x1001c2db <block_write+1131>: call 0x1001819c <__mark_buffer_dirty>
  1801. End of assembler dump.
  1802. At that point, bh is in %edx (address 0x1001c2da), which is calculated
  1803. at 0x1001c2c2 as %ebp + 0xfffffdd4, so I figure exactly what that is,
  1804. taking %ebp from the sigcontext_struct above:
  1805. (gdb) p (void *)1342631484
  1806. $5 = (void *) 0x5006ee3c
  1807. (gdb) p 0x5006ee3c+0xfffffdd4
  1808. $6 = 1342630928
  1809. (gdb) p (void *)$6
  1810. $7 = (void *) 0x5006ec10
  1811. (gdb) p *((void **)$7)
  1812. $8 = (void *) 0x50100200
  1813. Now, I look at the structure to see what's in it, and particularly,
  1814. what its b_data field contains:
  1815. (gdb) p *((struct buffer_head *)0x50100200)
  1816. $13 = {b_next = 0x50289380, b_blocknr = 49405, b_size = 1024, b_list = 0,
  1817. b_dev = 15872, b_count = {counter = 1}, b_rdev = 15872, b_state = 24,
  1818. b_flushtime = 0, b_next_free = 0x501001a0, b_prev_free = 0x50100260,
  1819. b_this_page = 0x501001a0, b_reqnext = 0x0, b_pprev = 0x507fcf58,
  1820. b_data = 0x50000800 "", b_page = 0x50004000,
  1821. b_end_io = 0x10017f60 <end_buffer_io_sync>, b_dev_id = 0x0,
  1822. b_rsector = 98810, b_wait = {lock = <optimized out or zero length>,
  1823. task_list = {next = 0x50100248, prev = 0x50100248}, __magic = 1343226448,
  1824. __creator = 0}, b_kiobuf = 0x0}
  1825. The b_data field is indeed 0x50000800, so the question becomes how
  1826. that happened. The rest of the structure looks fine, so this probably
  1827. is not a case of data corruption. It happened on purpose somehow.
  1828. The b_page field is a pointer to the page_struct representing the
  1829. 0x50000000 page. Looking at it shows the kernel's idea of the state
  1830. of that page:
  1831. (gdb) p *$13.b_page
  1832. $17 = {list = {next = 0x50004a5c, prev = 0x100c5174}, mapping = 0x0,
  1833. index = 0, next_hash = 0x0, count = {counter = 1}, flags = 132, lru = {
  1834. next = 0x50008460, prev = 0x50019350}, wait = {
  1835. lock = <optimized out or zero length>, task_list = {next = 0x50004024,
  1836. prev = 0x50004024}, __magic = 1342193708, __creator = 0},
  1837. pprev_hash = 0x0, buffers = 0x501002c0, virtual = 1342177280,
  1838. zone = 0x100c5160}
  1839. Some sanity-checking: the virtual field shows the "virtual" address of
  1840. this page, which in this kernel is the same as its "physical" address,
  1841. and the page_struct itself should be mem_map[0], since it represents
  1842. the first page of memory:
  1843. (gdb) p (void *)1342177280
  1844. $18 = (void *) 0x50000000
  1845. (gdb) p mem_map
  1846. $19 = (mem_map_t *) 0x50004000
  1847. These check out fine.
  1848. Now to check out the page_struct itself. In particular, the flags
  1849. field shows whether the page is considered free or not:
  1850. (gdb) p (void *)132
  1851. $21 = (void *) 0x84
  1852. The "reserved" bit is the high bit, which is definitely not set, so
  1853. the kernel considers the signal stack page to be free and available to
  1854. be used.
  1855. At this point, I jump to conclusions and start looking at my early
  1856. boot code, because that's where that page is supposed to be reserved.
  1857. In my setup_arch procedure, I have the following code which looks just
  1858. fine:
  1859. bootmap_size = init_bootmem(start_pfn, end_pfn - start_pfn);
  1860. free_bootmem(__pa(low_physmem) + bootmap_size, high_physmem - low_physmem);
  1861. Two stack pages have already been allocated, and low_physmem points to
  1862. the third page, which is the beginning of free memory.
  1863. The init_bootmem call declares the entire memory to the boot memory
  1864. manager, which marks it all reserved. The free_bootmem call frees up
  1865. all of it, except for the first two pages. This looks correct to me.
  1866. So, I decide to see init_bootmem run and make sure that it is marking
  1867. those first two pages as reserved. I never get that far.
  1868. Stepping into init_bootmem, and looking at bootmem_map before looking
  1869. at what it contains shows the following:
  1870. (gdb) p bootmem_map
  1871. $3 = (void *) 0x50000000
  1872. Aha! The light dawns. That first page is doing double duty as a
  1873. stack and as the boot memory map. The last thing that the boot memory
  1874. manager does is to free the pages used by its memory map, so this page
  1875. is getting freed even its marked as reserved.
  1876. The fix was to initialize the boot memory manager before allocating
  1877. those two stack pages, and then allocate them through the boot memory
  1878. manager. After doing this, and fixing a couple of subsequent buglets,
  1879. the stack corruption problem disappeared.
  1880. 1133.. WWhhaatt ttoo ddoo wwhheenn UUMMLL ddooeessnn''tt wwoorrkk
  1881. 1133..11.. SSttrraannggee ccoommppiillaattiioonn eerrrroorrss wwhheenn yyoouu bbuuiilldd ffrroomm ssoouurrccee
  1882. As of test11, it is necessary to have "ARCH=um" in the environment or
  1883. on the make command line for all steps in building UML, including
  1884. clean, distclean, or mrproper, config, menuconfig, or xconfig, dep,
  1885. and linux. If you forget for any of them, the i386 build seems to
  1886. contaminate the UML build. If this happens, start from scratch with
  1887. host%
  1888. make mrproper ARCH=um
  1889. and repeat the build process with ARCH=um on all the steps.
  1890. See ``Compiling the kernel and modules'' for more details.
  1891. Another cause of strange compilation errors is building UML in
  1892. /usr/src/linux. If you do this, the first thing you need to do is
  1893. clean up the mess you made. The /usr/src/linux/asm link will now
  1894. point to /usr/src/linux/asm-um. Make it point back to
  1895. /usr/src/linux/asm-i386. Then, move your UML pool someplace else and
  1896. build it there. Also see below, where a more specific set of symptoms
  1897. is described.
  1898. 1133..33.. AA vvaarriieettyy ooff ppaanniiccss aanndd hhaannggss wwiitthh //ttmmpp oonn aa rreeiisseerrffss ffiilleessyyss--
  1899. tteemm
  1900. I saw this on reiserfs 3.5.21 and it seems to be fixed in 3.5.27.
  1901. Panics preceded by
  1902. Detaching pid nnnn
  1903. are diagnostic of this problem. This is a reiserfs bug which causes a
  1904. thread to occasionally read stale data from a mmapped page shared with
  1905. another thread. The fix is to upgrade the filesystem or to have /tmp
  1906. be an ext2 filesystem.
  1907. 1133..44.. TThhee ccoommppiillee ffaaiillss wwiitthh eerrrroorrss aabboouutt ccoonnfflliiccttiinngg ttyyppeess ffoorr
  1908. ''ooppeenn'',, ''dduupp'',, aanndd ''wwaaiittppiidd''
  1909. This happens when you build in /usr/src/linux. The UML build makes
  1910. the include/asm link point to include/asm-um. /usr/include/asm points
  1911. to /usr/src/linux/include/asm, so when that link gets moved, files
  1912. which need to include the asm-i386 versions of headers get the
  1913. incompatible asm-um versions. The fix is to move the include/asm link
  1914. back to include/asm-i386 and to do UML builds someplace else.
  1915. 1133..55.. UUMMLL ddooeessnn''tt wwoorrkk wwhheenn //ttmmpp iiss aann NNFFSS ffiilleessyysstteemm
  1916. This seems to be a similar situation with the ReiserFS problem above.
  1917. Some versions of NFS seems not to handle mmap correctly, which UML
  1918. depends on. The workaround is have /tmp be a non-NFS directory.
  1919. 1133..66.. UUMMLL hhaannggss oonn bboooott wwhheenn ccoommppiilleedd wwiitthh ggpprrooff ssuuppppoorrtt
  1920. If you build UML with gprof support and, early in the boot, it does
  1921. this
  1922. kernel BUG at page_alloc.c:100!
  1923. you have a buggy gcc. You can work around the problem by removing
  1924. UM_FASTCALL from CFLAGS in arch/um/Makefile-i386. This will open up
  1925. another bug, but that one is fairly hard to reproduce.
  1926. 1133..77.. ssyyssllooggdd ddiieess wwiitthh aa SSIIGGTTEERRMM oonn ssttaarrttuupp
  1927. The exact boot error depends on the distribution that you're booting,
  1928. but Debian produces this:
  1929. /etc/rc2.d/S10sysklogd: line 49: 93 Terminated
  1930. start-stop-daemon --start --quiet --exec /sbin/syslogd -- $SYSLOGD
  1931. This is a syslogd bug. There's a race between a parent process
  1932. installing a signal handler and its child sending the signal. See
  1933. this uml-devel post <http://www.geocrawler.com/lists/3/Source-
  1934. Forge/709/0/6612801> for the details.
  1935. 1133..88.. TTUUNN//TTAAPP nneettwwoorrkkiinngg ddooeessnn''tt wwoorrkk oonn aa 22..44 hhoosstt
  1936. There are a couple of problems which were
  1937. <http://www.geocrawler.com/lists/3/SourceForge/597/0/> name="pointed
  1938. out"> by Tim Robinson <timro at trkr dot net>
  1939. +o It doesn't work on hosts running 2.4.7 (or thereabouts) or earlier.
  1940. The fix is to upgrade to something more recent and then read the
  1941. next item.
  1942. +o If you see
  1943. File descriptor in bad state
  1944. when you bring up the device inside UML, you have a header mismatch
  1945. between the original kernel and the upgraded one. Make /usr/src/linux
  1946. point at the new headers. This will only be a problem if you build
  1947. uml_net yourself.
  1948. 1133..99.. YYoouu ccaann nneettwwoorrkk ttoo tthhee hhoosstt bbuutt nnoott ttoo ootthheerr mmaacchhiinneess oonn tthhee
  1949. nneett
  1950. If you can connect to the host, and the host can connect to UML, but
  1951. you cannot connect to any other machines, then you may need to enable
  1952. IP Masquerading on the host. Usually this is only experienced when
  1953. using private IP addresses (192.168.x.x or 10.x.x.x) for host/UML
  1954. networking, rather than the public address space that your host is
  1955. connected to. UML does not enable IP Masquerading, so you will need
  1956. to create a static rule to enable it:
  1957. host%
  1958. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  1959. Replace eth0 with the interface that you use to talk to the rest of
  1960. the world.
  1961. Documentation on IP Masquerading, and SNAT, can be found at
  1962. www.netfilter.org <http://www.netfilter.org> .
  1963. If you can reach the local net, but not the outside Internet, then
  1964. that is usually a routing problem. The UML needs a default route:
  1965. UML#
  1966. route add default gw gateway IP
  1967. The gateway IP can be any machine on the local net that knows how to
  1968. reach the outside world. Usually, this is the host or the local net-
  1969. work's gateway.
  1970. Occasionally, we hear from someone who can reach some machines, but
  1971. not others on the same net, or who can reach some ports on other
  1972. machines, but not others. These are usually caused by strange
  1973. firewalling somewhere between the UML and the other box. You track
  1974. this down by running tcpdump on every interface the packets travel
  1975. over and see where they disappear. When you find a machine that takes
  1976. the packets in, but does not send them onward, that's the culprit.
  1977. 1133..1100.. II hhaavvee nnoo rroooott aanndd II wwaanntt ttoo ssccrreeaamm
  1978. Thanks to Birgit Wahlich for telling me about this strange one. It
  1979. turns out that there's a limit of six environment variables on the
  1980. kernel command line. When that limit is reached or exceeded, argument
  1981. processing stops, which means that the 'root=' argument that UML
  1982. usually adds is not seen. So, the filesystem has no idea what the
  1983. root device is, so it panics.
  1984. The fix is to put less stuff on the command line. Glomming all your
  1985. setup variables into one is probably the best way to go.
  1986. 1133..1111.. UUMMLL bbuuiilldd ccoonnfflliicctt bbeettwweeeenn ppttrraaccee..hh aanndd uuccoonntteexxtt..hh
  1987. On some older systems, /usr/include/asm/ptrace.h and
  1988. /usr/include/sys/ucontext.h define the same names. So, when they're
  1989. included together, the defines from one completely mess up the parsing
  1990. of the other, producing errors like:
  1991. /usr/include/sys/ucontext.h:47: parse error before
  1992. `10'
  1993. plus a pile of warnings.
  1994. This is a libc botch, which has since been fixed, and I don't see any
  1995. way around it besides upgrading.
  1996. 1133..1122.. TThhee UUMMLL BBooggooMMiippss iiss eexxaaccttllyy hhaallff tthhee hhoosstt''ss BBooggooMMiippss
  1997. On i386 kernels, there are two ways of running the loop that is used
  1998. to calculate the BogoMips rating, using the TSC if it's there or using
  1999. a one-instruction loop. The TSC produces twice the BogoMips as the
  2000. loop. UML uses the loop, since it has nothing resembling a TSC, and
  2001. will get almost exactly the same BogoMips as a host using the loop.
  2002. However, on a host with a TSC, its BogoMips will be double the loop
  2003. BogoMips, and therefore double the UML BogoMips.
  2004. 1133..1133.. WWhheenn yyoouu rruunn UUMMLL,, iitt iimmmmeeddiiaatteellyy sseeggffaauullttss
  2005. If the host is configured with the 2G/2G address space split, that's
  2006. why. See ``UML on 2G/2G hosts'' for the details on getting UML to
  2007. run on your host.
  2008. 1133..1144.. xxtteerrmmss aappppeeaarr,, tthheenn iimmmmeeddiiaatteellyy ddiissaappppeeaarr
  2009. If you're running an up to date kernel with an old release of
  2010. uml_utilities, the port-helper program will not work properly, so
  2011. xterms will exit straight after they appear. The solution is to
  2012. upgrade to the latest release of uml_utilities. Usually this problem
  2013. occurs when you have installed a packaged release of UML then compiled
  2014. your own development kernel without upgrading the uml_utilities from
  2015. the source distribution.
  2016. 1133..1155.. AAnnyy ootthheerr ppaanniicc,, hhaanngg,, oorr ssttrraannggee bbeehhaavviioorr
  2017. If you're seeing truly strange behavior, such as hangs or panics that
  2018. happen in random places, or you try running the debugger to see what's
  2019. happening and it acts strangely, then it could be a problem in the
  2020. host kernel. If you're not running a stock Linus or -ac kernel, then
  2021. try that. An early version of the preemption patch and a 2.4.10 SuSE
  2022. kernel have caused very strange problems in UML.
  2023. Otherwise, let me know about it. Send a message to one of the UML
  2024. mailing lists - either the developer list - user-mode-linux-devel at
  2025. lists dot sourceforge dot net (subscription info) or the user list -
  2026. user-mode-linux-user at lists dot sourceforge do net (subscription
  2027. info), whichever you prefer. Don't assume that everyone knows about
  2028. it and that a fix is imminent.
  2029. If you want to be super-helpful, read ``Diagnosing Problems'' and
  2030. follow the instructions contained therein.
  2031. 1144.. DDiiaaggnnoossiinngg PPrroobblleemmss
  2032. If you get UML to crash, hang, or otherwise misbehave, you should
  2033. report this on one of the project mailing lists, either the developer
  2034. list - user-mode-linux-devel at lists dot sourceforge dot net
  2035. (subscription info) or the user list - user-mode-linux-user at lists
  2036. dot sourceforge dot net (subscription info). When you do, it is
  2037. likely that I will want more information. So, it would be helpful to
  2038. read the stuff below, do whatever is applicable in your case, and
  2039. report the results to the list.
  2040. For any diagnosis, you're going to need to build a debugging kernel.
  2041. The binaries from this site aren't debuggable. If you haven't done
  2042. this before, read about ``Compiling the kernel and modules'' and
  2043. ``Kernel debugging'' UML first.
  2044. 1144..11.. CCaassee 11 :: NNoorrmmaall kkeerrnneell ppaanniiccss
  2045. The most common case is for a normal thread to panic. To debug this,
  2046. you will need to run it under the debugger (add 'debug' to the command
  2047. line). An xterm will start up with gdb running inside it. Continue
  2048. it when it stops in start_kernel and make it crash. Now ^C gdb and
  2049. If the panic was a "Kernel mode fault", then there will be a segv
  2050. frame on the stack and I'm going to want some more information. The
  2051. stack might look something like this:
  2052. (UML gdb) backtrace
  2053. #0 0x1009bf76 in __sigprocmask (how=1, set=0x5f347940, oset=0x0)
  2054. at ../sysdeps/unix/sysv/linux/sigprocmask.c:49
  2055. #1 0x10091411 in change_sig (signal=10, on=1) at process.c:218
  2056. #2 0x10094785 in timer_handler (sig=26) at time_kern.c:32
  2057. #3 0x1009bf38 in __restore ()
  2058. at ../sysdeps/unix/sysv/linux/i386/sigaction.c:125
  2059. #4 0x1009534c in segv (address=8, ip=268849158, is_write=2, is_user=0)
  2060. at trap_kern.c:66
  2061. #5 0x10095c04 in segv_handler (sig=11) at trap_user.c:285
  2062. #6 0x1009bf38 in __restore ()
  2063. I'm going to want to see the symbol and line information for the value
  2064. of ip in the segv frame. In this case, you would do the following:
  2065. (UML gdb) i sym 268849158
  2066. and
  2067. (UML gdb) i line *268849158
  2068. The reason for this is the __restore frame right above the segv_han-
  2069. dler frame is hiding the frame that actually segfaulted. So, I have
  2070. to get that information from the faulting ip.
  2071. 1144..22.. CCaassee 22 :: TTrraacciinngg tthhrreeaadd ppaanniiccss
  2072. The less common and more painful case is when the tracing thread
  2073. panics. In this case, the kernel debugger will be useless because it
  2074. needs a healthy tracing thread in order to work. The first thing to
  2075. do is get a backtrace from the tracing thread. This is done by
  2076. figuring out what its pid is, firing up gdb, and attaching it to that
  2077. pid. You can figure out the tracing thread pid by looking at the
  2078. first line of the console output, which will look like this:
  2079. tracing thread pid = 15851
  2080. or by running ps on the host and finding the line that looks like
  2081. this:
  2082. jdike 15851 4.5 0.4 132568 1104 pts/0 S 21:34 0:05 ./linux [(tracing thread)]
  2083. If the panic was 'segfault in signals', then follow the instructions
  2084. above for collecting information about the location of the seg fault.
  2085. If the tracing thread flaked out all by itself, then send that
  2086. backtrace in and wait for our crack debugging team to fix the problem.
  2087. 1144..33.. CCaassee 33 :: TTrraacciinngg tthhrreeaadd ppaanniiccss ccaauusseedd bbyy ootthheerr tthhrreeaaddss
  2088. However, there are cases where the misbehavior of another thread
  2089. caused the problem. The most common panic of this type is:
  2090. wait_for_stop failed to wait for <pid> to stop with <signal number>
  2091. In this case, you'll need to get a backtrace from the process men-
  2092. tioned in the panic, which is complicated by the fact that the kernel
  2093. debugger is defunct and without some fancy footwork, another gdb can't
  2094. attach to it. So, this is how the fancy footwork goes:
  2095. In a shell:
  2096. host% kill -STOP pid
  2097. Run gdb on the tracing thread as described in case 2 and do:
  2098. (host gdb) call detach(pid)
  2099. If you get a segfault, do it again. It always works the second time.
  2100. Detach from the tracing thread and attach to that other thread:
  2101. (host gdb) detach
  2102. (host gdb) attach pid
  2103. If gdb hangs when attaching to that process, go back to a shell and
  2104. do:
  2105. host%
  2106. kill -CONT pid
  2107. And then get the backtrace:
  2108. (host gdb) backtrace
  2109. 1144..44.. CCaassee 44 :: HHaannggss
  2110. Hangs seem to be fairly rare, but they sometimes happen. When a hang
  2111. happens, we need a backtrace from the offending process. Run the
  2112. kernel debugger as described in case 1 and get a backtrace. If the
  2113. current process is not the idle thread, then send in the backtrace.
  2114. You can tell that it's the idle thread if the stack looks like this:
  2115. #0 0x100b1401 in __libc_nanosleep ()
  2116. #1 0x100a2885 in idle_sleep (secs=10) at time.c:122
  2117. #2 0x100a546f in do_idle () at process_kern.c:445
  2118. #3 0x100a5508 in cpu_idle () at process_kern.c:471
  2119. #4 0x100ec18f in start_kernel () at init/main.c:592
  2120. #5 0x100a3e10 in start_kernel_proc (unused=0x0) at um_arch.c:71
  2121. #6 0x100a383f in signal_tramp (arg=0x100a3dd8) at trap_user.c:50
  2122. If this is the case, then some other process is at fault, and went to
  2123. sleep when it shouldn't have. Run ps on the host and figure out which
  2124. process should not have gone to sleep and stayed asleep. Then attach
  2125. to it with gdb and get a backtrace as described in case 3.
  2126. 1155.. TThhaannkkss
  2127. A number of people have helped this project in various ways, and this
  2128. page gives recognition where recognition is due.
  2129. If you're listed here and you would prefer a real link on your name,
  2130. or no link at all, instead of the despammed email address pseudo-link,
  2131. let me know.
  2132. If you're not listed here and you think maybe you should be, please
  2133. let me know that as well. I try to get everyone, but sometimes my
  2134. bookkeeping lapses and I forget about contributions.
  2135. 1155..11.. CCooddee aanndd DDooccuummeennttaattiioonn
  2136. Rusty Russell <rusty at linuxcare.com.au> -
  2137. +o wrote the HOWTO <http://user-mode-
  2138. linux.sourceforge.net/UserModeLinux-HOWTO.html>
  2139. +o prodded me into making this project official and putting it on
  2140. SourceForge
  2141. +o came up with the way cool UML logo <http://user-mode-
  2142. linux.sourceforge.net/uml-small.png>
  2143. +o redid the config process
  2144. Peter Moulder <reiter at netspace.net.au> - Fixed my config and build
  2145. processes, and added some useful code to the block driver
  2146. Bill Stearns <wstearns at pobox.com> -
  2147. +o HOWTO updates
  2148. +o lots of bug reports
  2149. +o lots of testing
  2150. +o dedicated a box (uml.ists.dartmouth.edu) to support UML development
  2151. +o wrote the mkrootfs script, which allows bootable filesystems of
  2152. RPM-based distributions to be cranked out
  2153. +o cranked out a large number of filesystems with said script
  2154. Jim Leu <jleu at mindspring.com> - Wrote the virtual ethernet driver
  2155. and associated usermode tools
  2156. Lars Brinkhoff <http://lars.nocrew.org/> - Contributed the ptrace
  2157. proxy from his own project <http://a386.nocrew.org/> to allow easier
  2158. kernel debugging
  2159. Andrea Arcangeli <andrea at suse.de> - Redid some of the early boot
  2160. code so that it would work on machines with Large File Support
  2161. Chris Emerson <http://www.chiark.greenend.org.uk/~cemerson/> - Did
  2162. the first UML port to Linux/ppc
  2163. Harald Welte <laforge at gnumonks.org> - Wrote the multicast
  2164. transport for the network driver
  2165. Jorgen Cederlof - Added special file support to hostfs
  2166. Greg Lonnon <glonnon at ridgerun dot com> - Changed the ubd driver
  2167. to allow it to layer a COW file on a shared read-only filesystem and
  2168. wrote the iomem emulation support
  2169. Henrik Nordstrom <http://hem.passagen.se/hno/> - Provided a variety
  2170. of patches, fixes, and clues
  2171. Lennert Buytenhek - Contributed various patches, a rewrite of the
  2172. network driver, the first implementation of the mconsole driver, and
  2173. did the bulk of the work needed to get SMP working again.
  2174. Yon Uriarte - Fixed the TUN/TAP network backend while I slept.
  2175. Adam Heath - Made a bunch of nice cleanups to the initialization code,
  2176. plus various other small patches.
  2177. Matt Zimmerman - Matt volunteered to be the UML Debian maintainer and
  2178. is doing a real nice job of it. He also noticed and fixed a number of
  2179. actually and potentially exploitable security holes in uml_net. Plus
  2180. the occasional patch. I like patches.
  2181. James McMechan - James seems to have taken over maintenance of the ubd
  2182. driver and is doing a nice job of it.
  2183. Chandan Kudige - wrote the umlgdb script which automates the reloading
  2184. of module symbols.
  2185. Steve Schmidtke - wrote the UML slirp transport and hostaudio drivers,
  2186. enabling UML processes to access audio devices on the host. He also
  2187. submitted patches for the slip transport and lots of other things.
  2188. David Coulson <http://davidcoulson.net> -
  2189. +o Set up the usermodelinux.org <http://usermodelinux.org> site,
  2190. which is a great way of keeping the UML user community on top of
  2191. UML goings-on.
  2192. +o Site documentation and updates
  2193. +o Nifty little UML management daemon UMLd
  2194. <http://uml.openconsultancy.com/umld/>
  2195. +o Lots of testing and bug reports
  2196. 1155..22.. FFlluusshhiinngg oouutt bbuuggss
  2197. +o Yuri Pudgorodsky
  2198. +o Gerald Britton
  2199. +o Ian Wehrman
  2200. +o Gord Lamb
  2201. +o Eugene Koontz
  2202. +o John H. Hartman
  2203. +o Anders Karlsson
  2204. +o Daniel Phillips
  2205. +o John Fremlin
  2206. +o Rainer Burgstaller
  2207. +o James Stevenson
  2208. +o Matt Clay
  2209. +o Cliff Jefferies
  2210. +o Geoff Hoff
  2211. +o Lennert Buytenhek
  2212. +o Al Viro
  2213. +o Frank Klingenhoefer
  2214. +o Livio Baldini Soares
  2215. +o Jon Burgess
  2216. +o Petru Paler
  2217. +o Paul
  2218. +o Chris Reahard
  2219. +o Sverker Nilsson
  2220. +o Gong Su
  2221. +o johan verrept
  2222. +o Bjorn Eriksson
  2223. +o Lorenzo Allegrucci
  2224. +o Muli Ben-Yehuda
  2225. +o David Mansfield
  2226. +o Howard Goff
  2227. +o Mike Anderson
  2228. +o John Byrne
  2229. +o Sapan J. Batia
  2230. +o Iris Huang
  2231. +o Jan Hudec
  2232. +o Voluspa
  2233. 1155..33.. BBuugglleettss aanndd cclleeaann--uuppss
  2234. +o Dave Zarzycki
  2235. +o Adam Lazur
  2236. +o Boria Feigin
  2237. +o Brian J. Murrell
  2238. +o JS
  2239. +o Roman Zippel
  2240. +o Wil Cooley
  2241. +o Ayelet Shemesh
  2242. +o Will Dyson
  2243. +o Sverker Nilsson
  2244. +o dvorak
  2245. +o v.naga srinivas
  2246. +o Shlomi Fish
  2247. +o Roger Binns
  2248. +o johan verrept
  2249. +o MrChuoi
  2250. +o Peter Cleve
  2251. +o Vincent Guffens
  2252. +o Nathan Scott
  2253. +o Patrick Caulfield
  2254. +o jbearce
  2255. +o Catalin Marinas
  2256. +o Shane Spencer
  2257. +o Zou Min
  2258. +o Ryan Boder
  2259. +o Lorenzo Colitti
  2260. +o Gwendal Grignou
  2261. +o Andre' Breiler
  2262. +o Tsutomu Yasuda
  2263. 1155..44.. CCaassee SSttuuddiieess
  2264. +o Jon Wright
  2265. +o William McEwan
  2266. +o Michael Richardson
  2267. 1155..55.. OOtthheerr ccoonnttrriibbuuttiioonnss
  2268. Bill Carr <Bill.Carr at compaq.com> made the Red Hat mkrootfs script
  2269. work with RH 6.2.
  2270. Michael Jennings <mikejen at hevanet.com> sent in some material which
  2271. is now gracing the top of the index page <http://user-mode-
  2272. linux.sourceforge.net/index.html> of this site.
  2273. SGI <http://www.sgi.com> (and more specifically Ralf Baechle <ralf at
  2274. uni-koblenz.de> ) gave me an account on oss.sgi.com
  2275. <http://www.oss.sgi.com> . The bandwidth there made it possible to
  2276. produce most of the filesystems available on the project download
  2277. page.
  2278. Laurent Bonnaud <Laurent.Bonnaud at inpg.fr> took the old grotty
  2279. Debian filesystem that I've been distributing and updated it to 2.2.
  2280. It is now available by itself here.
  2281. Rik van Riel gave me some ftp space on ftp.nl.linux.org so I can make
  2282. releases even when Sourceforge is broken.
  2283. Rodrigo de Castro looked at my broken pte code and told me what was
  2284. wrong with it, letting me fix a long-standing (several weeks) and
  2285. serious set of bugs.
  2286. Chris Reahard built a specialized root filesystem for running a DNS
  2287. server jailed inside UML. It's available from the download
  2288. <http://user-mode-linux.sourceforge.net/dl-sf.html> page in the Jail
  2289. Filesystems section.