[BACK]Return to rump.html CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / htdocs / docs / puffs

File: [cvs.NetBSD.org] / htdocs / docs / puffs / rump.html (download) (as text)

Revision 1.29, Sat Mar 18 02:27:20 2017 UTC (7 years, 1 month ago) by maya
Branch: MAIN
Changes since 1.28: +1 -1 lines

Full website regen for dummy mobile design element.
This shouldn't have any visual effect.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="generator" content="Website XSL Stylesheet V2.6.0">
<link rel="home" href="../../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
<link rel="up" href="../../docs/puffs/." title="Filesystems in userspace: puffs, refuse, FUSE, and more">
<link rel="previous" href="../../docs/puffs/." title="Filesystems in userspace: puffs, refuse, FUSE, and more">
<link rel="next" href="../../docs/research/." title="NetBSD Documentation: Research of interest to NetBSD">
<link rel="stylesheet" href="../../global.css" type="text/css">

<title>Kernel File Systems as Userspace Servers</title>
</head>
<body class="website"><div class="webpage">
<a name="docs-puffs-rump"></a><div id="top"><a href="#mainContent" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
<div id="centralHeader"><div id="logo">
<a href="../../"><img alt="[NetBSD Logo]" src="../../images/NetBSD-smaller.png"></a><div id="name"><a href="../../">
	  The NetBSD Project
	</a></div>
<div id="slogan"><a href="../../">
	  &#8220;Of course it runs NetBSD&#8221;
	</a></div>
</div></div>
<input id="hamburger" type="checkbox"><label class="menuicon" for="hamburger"><span></span></label><div id="navBar" role="navigation">
<span class="doNotDisplay">
	  Navigation:
	</span><ul>
<li><a href="../../">
	  Home</a></li>
<li>
<a href="../../">
	  News &amp; Media</a><ul>
<li><a href="../../changes/">
	    Recent changes</a></li>
<li><a href="http://blog.NetBSD.org/">
	    NetBSD blog</a></li>
<li><a href="../../gallery/events.html">
	    Events</a></li>
<li><a href="../../changes/rss.html">
	    Feeds</a></li>
</ul>
</li>
<li>
<a href="../../about/">
	  About</a><ul>
<li><a href="../../about/">
	    NetBSD</a></li>
<li><a href="../../foundation/">
	    The NetBSD Foundation</a></li>
<li><a href="../../gallery/">
	    Advocacy</a></li>
</ul>
</li>
<li>
<a href="../../docs/">
	  Documentation</a><ul>
<li><a href="../../docs/misc/index.html">
	    FAQ &amp; HOWTOs</a></li>
<li><a href="../../docs/guide/en/">
	    The Guide</a></li>
<li><a href="http://man.NetBSD.org/">
	    Manual pages</a></li>
<li><a href="http://wiki.NetBSD.org/">
	    Wiki</a></li>
</ul>
</li>
<li>
<a href="../../support/">
	  Support</a><ul>
<li><a href="../../support/send-pr.html">
	    Problem report guide</a></li>
<li><a href="../../cgi-bin/sendpr.cgi?gndb=netbsd">
	    Report a bug</a></li>
<li><a href="../../support/query-pr.html">
	    Query bug database</a></li>
<li><a href="../../support/security/">
	    Security</a></li>
</ul>
</li>
<li>
<a href="../../community/">
	  Community</a><ul>
<li><a href="http://netbsd.fi/">
	    Blogs</a></li>
<li><a href="../../mailinglists/">
	    Mailing lists</a></li>
<li><a href="http://mail-index.NetBSD.org/">
	    List archives</a></li>
</ul>
</li>
<li>
<a href="../../developers/">
	  Developers</a><ul>
<li><a href="http://cvsweb.NetBSD.org/">
	    Browse source</a></li>
<li><a href="http://nxr.NetBSD.org/">
	    Cross-reference</a></li>
<li><a href="http://releng.NetBSD.org/">
	    Release engineering</a></li>
<li><a href="http://wiki.NetBSD.org/projects/">
	    Projects list</a></li>
</ul>
</li>
<li>
<a href="../../ports/">
	  Ports</a><ul>
<li><a href="../../ports/history.html">
	    History</a></li>
<li><a href="../../ports/emulators.html">
	    Emulators</a></li>
</ul>
</li>
<li>
<a href="http://www.pkgsrc.org/">
	  Packages</a><ul>
<li><a href="http://www.pkgsrc.se/">
	    Browse packages</a></li>
<li><a href="http://releng.NetBSD.org/index-pkgsrc.html">
	    Release engineering</a></li>
</ul>
</li>
</ul>
</div>
<div id="content"><div class="fullWidth"><div class="rowOfBoxes">
<h1>Kernel File Systems as Userspace Servers</h1>
<div class="sect1">
<div class="titlepage"></div>
</div>
<h3 class="title"><a name="kernfs-server"></a></h3>
<ul>
<li><a href="#about">On Kernel File System Servers</a></li>
<li><a href="#use">Mounting and Use</a></li>
<li><a href="#internals">Internals</a></li>
</ul>
<hr>
<h3 class="title"></h3>
<p>
    This chapter describes the symbiosis of
    background knowledge on them, see the respective web pages.
  </p>
    <h4 class="title">
<a name="about"></a>On Kernel File System Servers (<a href="#kernfs-server">top</a>)
  </h4>

    <p>
      The integration of the <a class="ulink" href="index.html" target="_top">puffs</a> and
      <a class="ulink" href="../rump/index.html" target="_top">rump</a> technologies
      enables mounting kernel file systems as userspace servers.
      Equivalent functionality to the in-kernel option is maintained,
      and an application accessing files is unable to tell the
      difference between the two.
    </p>

    <p>
      A useful scenario for mounting a kernel file system as a userspace
      server is accessing untrusted media.  As file system code is
      generally authored assuming a trusted and correct file system
      image, a corrupt or deliberately modified image can easily cause a
      kernel crash or security compromise.  By using a userspace server,
      the compromise is limited to the userspace server program, not the
      whole system.
    </p>

    <p>
      It also enables the mounting of kernel file systems which are not
      included as part of the kernel and loading a module is not
      desired.  Additionally, using kernel file systems from different
      operating system versions is possible, since interfacing with
      the kernel is done through the puffs protocol, not the
      kernel binary interface.  This is desired for example when
      wanting to take advantage of new functionality without upgrading
      the operating system or wanting to do a partial rollback to avoid
      a regression in a newer version.
    </p>

    <div class="figure">
<a name="rump-filesystem"></a><p class="title"><b>Figure. Ĉile System Access Comparison</b></p>
<div class="figure-contents">
     
     <div class="mediaobject"><img src="rump.png" alt="File System Access Comparison"></div>
   </div>
</div>
<br class="figure-break">

  
    <h4 class="title">
<a name="use"></a>Mounting and Use (<a href="#kernfs-server">top</a>)
  </h4>
    
    <p>
      The use of kernel file systems as userspace servers requires
      the support for <a class="ulink" href="index.html" target="_top">puffs</a> in the
      kernel.
    </p>

    <p>
      To mount the file system, the relevant <span class="command"><strong>rump_fs</strong></span>
      command must be run.  These commands share the same suffix as the
      normal in-kernel <span class="command"><strong>mount_fs</strong></span> commands.  For
      instance, the equivalent of <span class="command"><strong>mount_msdos</strong></span> is
      <span class="command"><strong>rump_msdos</strong></span>.  The usage is also equal, so the
      manual page of the mount equivalent should be consulted.  The only
      exception is that rump file systems do not require the use of
      <span class="command"><strong>vnconfig</strong></span> to mount regular files.  Rather, such
      images can be mounted directly by using the image as the
      device file path.
    </p>

    <p>
      To unmount, <span class="command"><strong>umount</strong></span> should be run as normal.
      While it is possible to violently kill the server process, this
      does not give the file system an opportunity to flush its caches
      and cleanly unmount and may result in data loss.  In case the
      server process is violently killed, puffs automatically performs a
      forced unmount and no further action is necessary.
    </p>

    <div class="sect4">
<div class="titlepage"><div><div><h5 class="title">
<a name="examples"></a>Examples</h5></div></div></div>
      

      <p>
        To mount a file system image as a read-only mount:

        </p>
<pre class="programlisting">
pain-rustique&gt; rump_ffs -o ro ~/img/ffs.img /mnt
OR
pain-rustique&gt; mount -t ffs -o ro,rump ~/img/ffs.img /mnt
</pre>
<p>

	If you want to mount a disk device instead, the procedure
	is the same.  This example also instructs the file system
	to use journalling.  Note: for reasons beyond the scope of
	this document, it is highly recommended you use the raw
	device instead of the usual block device.

        </p>
<pre class="programlisting">
pain-rustique&gt; rump_ffs -o log /dev/rwd0e /mnt2
</pre>
<p>

        Mounting nfs works in a similar fashion.  The command line flag
        <code class="code">-p</code> makes sure a non-root mount is succesful if the
        server allows them:

        </p>
<pre class="programlisting">
pain-rustique&gt; rump_nfs -p host:/export /mnt3
</pre>
<p>

        Finally, the option <code class="option">rump</code> in fstab signals that
	the file system should be mounted using rump instead of the
	kernel file service.  The following example is for specifying an
	nfs share mount from a laptop over wireless:
        </p>
<pre class="programlisting">
server:/m/server    /m/server    nfs    rw,noauto,-r=8192,-w=8192,rump
</pre>
<p>
      </p>

      <p>
        After this the file system will show up on the mountlist and you
        can access it through the mountpath like any other mounted file
        system.
      </p>

    </div>
  
    <h4 class="title">
<a name="internals"></a>Internals (<a href="#kernfs-server">top</a>)
  </h4>

    <p>
      Internally, kernel file systems are implemented against the
      kernel virtual file system layer.  This layer defines a protocol
      which kernel file systems convert to their backend storage
      protocol to satisfy the operation.  The result is then converted
      back to a format the virtual file system layer understands and
      passed back to caller (most likely an application, although it can
      be for example the NFS server).
    </p>

    <p>
      Analogously, puffs file systems must interpret and convert the
      puffs file system interface protocol.  While the puffs interface
      is very similar to the kernel virtual file system interface,
      there are differences in some parameters.  For example, the
      virtual file system passes information about I/O as a
      reference to <code class="code">struct uiomove</code>.  In contrast, puffs
      passes this as explicit parameters.
    </p>

    <p>
      Since a userspace kernel file system server attaches itself
      as a puffs file system, protocol conversion from puffs to the
      kernel virtual file system must happen, if the whole protocol
      stack is to work.  This conversion of protocols is done by
      the p2k, or puffs-to-kernel, component.  It is installed
      as <code class="filename">libp2k</code> and linked with all kernel
      file system servers.
    </p>
  </div></div></div>
<div class="navfoot"></div>
<div id="footer"><div id="footerContent"><center>
<span class="footfeed"><a href="http://www.NetBSD.org/cgi-bin/feedback.cgi">
	  Contact</a> |
      </span><span class="footcopy"><a href="../../about/disclaimer.html">
      Disclaimer</a> |

      <span class="copyright">Copyright 1994-2017 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>/sup> is a registered trademark of The NetBSD
	Foundation, Inc.</span>
</center></div></div>
</div></body>
</html>