1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<title>skas mode</title>
</head>
<body alink="#FF0000" vlink="#55188A" link="#0000EF" bgcolor="#FFFFFF" text="#000099">
<table border="0">
<tr align="left">
<td valign="top">
<table border="0">
<tr align="left"><td valign="top" >
<img src="http://user-mode-linux.sourceforge.net/uml-small.png" height="171" width="120"/>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/index.html">Site Home Page</a></font>
<br>
<font size="-1"><a href="http://uml.harlowhill.com">The UML Wiki</a></font>
<br>
<font size="-1"><a href="http://usermodelinux.org">UML Community Site</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/roadmap.html">The UML roadmap</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/uses.html">What it's good for</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/case-studies.html">Case Studies</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/kernel.html">Kernel Capabilities</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/dl-sf.html">Downloading it</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/run.html">Running it</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/compile.html">Compiling</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/install.html">Installation</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/skas.html">Skas Mode</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/patches.html">Incremental Patches</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/tests.html">Test Suite</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/devanon.html">Host memory use</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/fs_making.html">Building filesystems</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/faq.html">Troubles</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/contrib.html">User Contributions</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/links.html">Related Links</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/todo.html">The ToDo list</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/projects.html">Projects</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/diary.html">Diary</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/thanks.html">Thanks</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/contacts.html">Contacts</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Tutorials<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO.html">The HOWTO (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO.txt">The HOWTO (text)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/hostfs.html">Host file access</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/input.html">Device inputs</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/shared_fs.html">Sharing filesystems</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/fs.html">Creating filesystems</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/resize.html">Resizing filesystems</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/networking.html">Virtual Networking</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/mconsole.html">Management Console</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/debugging.html">Kernel Debugging</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/honeypots.html">UML Honeypots</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/gprof.html">gprof and gcov</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/xtut.html">Running X</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/trouble.html">Diagnosing problems</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/config.html">Configuration</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slack_readme.html">Installing Slackware</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/arch-port.html">Porting UML</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/iomem.html">IO memory emulation</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/2G-2G.html">UML on 2G/2G hosts</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/lksct/index.html">Adding a UML system call</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/nesting.html">Running nested UMLs</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">How you can help<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/help-gen.html">Overview</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/help-doc.html">Documentation</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/help-userspace.html">Utilities</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/help-kernel-v1.html">Kernel bugs</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/projects.html">Kernel projects</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Screenshots<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/net.html">A virtual network</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/x.html">An X session</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Transcripts<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/login.html">A login session</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/debug-session.html">A debugging session</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slackinst.html">Slackware installation</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Reference<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/switches.html">Kernel switches</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slack_readme.html">Slackware README</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Papers<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2000/index.html">ALS 2000 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2000.tex">ALS 2000 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/als2000/slides.html">ALS 2000 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lca2001/lca.html">LCA 2001 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ols2001/index.html">OLS 2001 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/ols2001.tex">OLS 2001 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2001/index.html">ALS 2001 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2001.tex">ALS 2001 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ists2002/umlsec.htm">UML security (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lca2002/lca2002.htm">LCA 2002 (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/wvu2002/wvu2002.htm">WVU 2002 (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ists_rt/ists_rt.htm">Security Roundtable (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ols2002/ols2002.html">OLS 2002 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lwe2005/LWE2005.html">LWE 2005 slides</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Fun and Games<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/cgi-bin/hangman">Kernel Hangman</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/sdotm.html">Disaster of the Month</a></font>
</td></tr>
</table>
</td>
<td valign="top" align="left">
<center>
<h3>skas mode</h3>
</center>
<a name="Introduction"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Introduction</font>
</b>
</td>
</tr>
</table>
<blockquote head="Introduction">
Traditionally, UML has had the following design
<ul>
<li>
each UML process gets a process on the host
</li>
<li>
there is a special thread, the tracing thread, which does system call
tracing on the UML processes
</li>
<li>
the tracing thread nullified system calls, and caused the process to
enter the UML kernel, which is mapped into the upper part of its
address space
</li>
</ul>
This was forced by the limited support for UML in Linux and has a
number of problems
<ul>
<li>
The UML kernel is present in the address space of each of its
processes, and, by default, is writeable. This is obviously a
security problem, since, with write access to kernel data, a process
can break out to the host. UML's 'jail' mode fixes this problem by
making UML data readonly while a process is running, but this imposes
a huge performance penalty. Also, the kernel is still there, and can
be read, so this isn't acceptable for honeypots, since a bad guy can
easily tell that the system is a UML.
</li>
<li>
UML uses signals to force control to the UML kernel during a system
call or interrupt. Signal delivery and return are slow, and impose a
noticable performance hit.
</li>
</ul>
During the fall of 2002, I started fixing these problems by adding
support in the host Linux for features that would solve these
problems. The result is now stable, and is being used by a number of
people with good results.
<p>
In short, the changes cause the UML kernel to run in an entirely
different host address space from its processes. This solves the
security and honeypot fingerprinting problems by making the UML kernel
totally inaccessible to UML processes. Their address spaces are
identical to what they would be on the host. This also provides a
noticable speedup by eliminating the signal delivery that used to
happen for every UML system call.
<p>
The old mode is now called 'tt mode', for Tracing Thread, and the new
mode is called 'skas mode', for Separate Kernel Address Space.
</blockquote>
<a name="Using skas mode"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Using skas mode</font>
</b>
</td>
</tr>
</table>
<blockquote head="Using skas mode">
Skas mode requires that a patch be applied to the host kernel. This
patch implements the address space support needed by skas mode, plus
some additions to ptrace which are necessary. The patch is available
from the <a href="dl-sf.html#Host patches">UML
download page</a>.
<p>
These patches are against 2.4.19, but are fairly non-intrusive, and
should apply to any nearby kernel. You should get the latest host skas
patch and run the latest UML on it. You should only use an older
host skas patch if you need to run an older UML for some reason.
<p>
With the patch applied to the host, all you need to do is make sure
that CONFIG_MODE_SKAS is enabled in UML, and run it. It will detect
the host support and use it. If the host support isn't there, it will
fall back to tt mode. It will also fall back to tt mode if it doesn't
detect a specific version of the host skas support. It will tell you
during the early boot which version it's looking for:
<tt>
<pre>
<font size="-1">
Checking for the skas3 patch in the host...found
Checking for /proc/mm...found
</font>
</pre>
</tt>
Once you see this, you're all set. UML is happily running in skas
mode.
</blockquote>
<a name="Skas effects on UML"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Skas effects on UML</font>
</b>
</td>
</tr>
</table>
<blockquote head="Skas effects on UML">
This is simple - you shouldn't really notice any difference, except
for performance. Inside UML, skas mode causes no changes in
functionality. For most uses, you should see a noticable improvement
in performance. My favorite benchmark, a kernel build, is almost
twice as fast with skas mode as with tt mode, and is within 30% of the
host's time. Bill Stearns saw a script's running time drop from ~50
seconds to ~14 seconds, almost a quadrupling in speed.
</blockquote>
<a name="Skas effects on the host"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Skas effects on the host</font>
</b>
</td>
</tr>
</table>
<blockquote head="Skas effects on the host">
You will notice some differences on the host. If you run ps, you will
notice only four processes per UML rather than the dozens that you see
in tt mode. They are
<ul>
<li>
The UML kernel thread, which runs in the separate kernel address
space, executes kernel code, and does system call interception on UML
processes
</li>
<li>
The UML userspace thread, which runs all UML process code and switches
between host address spaces on each UML context switch
</li>
<li>
The ubd driver asynchronous IO thread
</li>
<li>
The write SIGIO emulation thread
</li>
</ul>
If you are running many UMLs on the host, and you convert them over to
skas mode, you will also notice a large reduction in the host load.
The UML server that I am most familiar with, which runs 25-30 UMLs at
any given time, reduced its typical load average from 2 - 5 with tt
mode to .1 - .5 with skas mode.
</blockquote>
<a name="Skas present"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Skas present</font>
</b>
</td>
</tr>
</table>
<blockquote head="Skas present">
I know of only one bug in the current skas patch, which only affects
running nested UMLs as far as I know. I have been running the skas3
patch continuously since the fall with no problems. Other people
have, as well, and I've heard of no problems from them. It's
SMP-safe, and it's running stably on SMP hosts.
</blockquote>
<a name="Skas future"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Skas future</font>
</b>
</td>
</tr>
</table>
<blockquote head="Skas future">
There is going to be a skas4 patch at some point. There will be no
real functional changes. The bug mentioned above will be fixed, and a
performance tweak or two will be added.
<p>
The major change will be the interface to the new stuff. Currently,
new address spaces are created by opening /proc/mm, and they are
modified by writing to the returned file descriptor. Linus hates this
interface (and I wasn't very fond of it, either). After some
discussion, he proposed adding two new system calls, one which creates
new address spaces, and another which executes an arbitrary system
call in the context of one of these address spaces.
<p>
The skas4 patch will implement these new system calls, and UML will
use them at that point. After that, when the patch has had some
testing, I will think about how and when to get it into the main
kernel pools.
</blockquote>
</td>
</tr>
</table>
<center>
<font size="-1">Hosted at </font>
<a href="http://sourceforge.net">
<img src="http://sourceforge.net/sflogo.php?group_id=429" width="88" height="31" border="0" alt="SourceForge Logo">
</a>
</center>
</body>
</html>
|