Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
         lofi mount
    1.2. Name of Document Author/Supplier:
         Author:  John Levon
    1.3  Date of This Document:
        29 April, 2008
4. Technical Description
1.  Introduction

    A long-standing RFE has been for direct support of loopback file
    mounts in the mount(1m) utility. This case defines such a feature.

    A patch binding is requested.

2.  Discussion

    On Solaris today, mounting a file system image is a two stage
    process:

        lofiadm -a /path/to/my.iso
        mount -F hsfs /dev/lofi/1 /mnt/myiso

    The same applies for the unmount process. Instead, it should be a
    single operation:

        mount -F hsfs /path/to/my.iso /mnt/myiso

    Internally, this will create a lofi minor node for the file and
    mount the filesystem from that node. Unmount will remove the lofi
    node again.

    When such a system is mounted, the user will see it listed in mount as
    usual:

        $ mount -v
        ...
        /lomount/1 on /lomount/ufs.good
read/write/nosetuid/nodevices/intr/largefiles/logging/xattr/onerror=panic/dev=2400001
on Fri Apr 25 07:08:17 2008


    Such entries may be placed in /etc/vfstab.

    In terms of permissions, PRIV_SYS_MOUNT is required, plus the
    ability to access the underlying file RO or RW, as needed.  No
    explicit permission to use lofi is needed.

    Such mounts are always forced as 'nosuid' (no setuid and no
    devices).

    Unlike lofiadm, a lofi mount of an existing block or character
    device is not supported.

    On some operating systems such as Linux, this feature requires an
    option "loop". This will not be necessary on Solaris, but in the
    interests of approachability, it will be silently ignored. The
    ability to explicitly specify the backing loop device is neither
    present nor needed.

    Zones do not support lofi(7d). This case doesn't change that.

    There is an interaction with lofi(7d) crypto support.  Currently,
    this case does not propose to extend mount(1m) options to include
    the ones needed for crypto support.  This may happen in the future.

    Compressed lofi(7d) support just works.

3.  VFS interface

    This feature requires explicit filesystem support in the relevant
    VFS_MOUNT() routine.
    
    In particular, a filesystem can call the following helper:

        int vfs_get_lofi(vfs_t *, vnode_t **);

    This returns the vnode for a lofi minor node corresponding to the
    mounted file. A filesystem would then use this vnode as the device
    to actually mount.

    For this to work, such a filesystem needs to skip the block device
    security check for the lofi node, as it could fail. However, the
    VOP_ACCESS() check on the mount source (which is a file for the lofi
    case) is still needed to ensure that the mount is secure.

    For example, a process with PRIV_SYS_MOUNT and
    PRIV_FILE_DAC_READ/WRITE would fail an explicit check to open the
    lofi node, but succeed in the mount source check (unless the file is
    root-owned, preserving standard semantics for least privilege).

    Currently, filesystem support exists for ufs, pcfs, hsfs, and udfs.
    ZFS support is unlikely to happen as it doesn't support traditional
    mounting in this manner.

    No change in behaviour should occur in filesystems that don't
    support this feature.

4.  lofi changes

    When unmounting such a mount, we need to take down the created lofi
    node. However, it may be held open. Rather than forcing removal of
    the node via ->li_force, we add a new option, ->li_cleanup. This
    only removes the lofi node when the last user closes it.

5.  Interface table

    lofi_ioctl                          Consolidation private, used and extended
                                        by this project
    New mount(1m) syntax.               Committed.

6.  References

        PSARC 1999/463 lofi - fast-track
        PSARC 2007/001 lofi(7d) crypto support
        6384817 Need persistant lofi based mounts and direct mount(1m) support
for lofi

7.  Manual page differences

--- mount.man   Mon Apr 28 06:57:24 2008
+++ mount.new   Mon Apr 28 06:55:53 2008
@@ -20,7 +20,6 @@
      mount [-F FSType] [generic_options] [-o specific_options]
          [-O] special mount_point
 
-
      mount -a [-F FSType] [-V] [current_options]
          [-o specific_options] [mount_point]...
 
@@ -83,10 +82,16 @@
      /etc/dfs/fstypes file. After filling in  missing  arguments,
      mount will invoke the FSType-specific mount module.
 
+     For file system types which support it, a file can be mounted
+     directly as a file system by specifying the full path to the
+     file as the special argument.  If specific file-system support
+     for such loopback file mounts is not present, lofiadm(1M) can
+     still be used by hand to mount a file-system image.
 
-     Only a super-user can mount or unmount  file  systems  using
-     mount  and  umount.  However, any user can use mount to list
-     mounted file systems and resources.
+     Only a user with sufficient privilege (at least PRIV_SYS_MOUNT)
+     can mount or unmount  file  systems  using mount  and  umount.
+     However, any user can use mount to list mounted file systems
+     and resources.
 
 OPTIONS
      -F FSType
@@ -224,7 +229,10 @@
                  for files within the file system.   The  default
                  is exec.
 
+             loop
 
+                Ignored for compatibility.
+
              nbmand | nonbmand
 
                  Allow or disallow non-blocking mandatory locking
@@ -411,9 +419,10 @@
 SEE ALSO
      mount_cachefs(1M),      mount_hsfs(1M),       mount_nfs(1M),
      mount_pcfs(1M),        mount_tmpfs(1M),       mount_ufs(1M),
+     mount_udfs(1M),
      mountall(1M), umountall(1M), fcntl(2),  mmap(2),  mnttab(4),
      vfstab(4),    attributes(   5),   largefile(5),   lofs(7FS),
-     pcfs(7FS)
+     pcfs(7FS), privileges(5), lofiadm(1M)
 
 NOTES
      If the directory on which a file system is to be mounted  is
--- mount_hsfs.man      Mon Apr 28 06:57:45 2008
+++ mount_hsfs.new      Mon Apr 28 06:55:09 2008
@@ -32,6 +32,7 @@
      the    missing    arguments,    including    the     FSType-
      specific_options; see mount(1M) for more details.
 
+     hsfs supports loopback file mounts: see mount(1M).
 
      A file system conforming to ISO 9660 can contain  extensions
      that  allow  it  to overcome limitations of the original ISO
--- mount_pcfs.man      Mon Apr 28 06:57:49 2008
+++ mount_pcfs.new      Mon Apr 28 06:56:16 2008
@@ -24,6 +24,7 @@
      mount  operation,  these are hidden until the file system is
      unmounted.
 
+     pcfs supports loopback file mounts: see mount(1M).
 
      If mount is invoked with special or mount_point as the  only
      arguments,  mount  will  search  /etc/vfstab  to fill in the
--- mount_udfs.man      Mon Apr 28 06:57:52 2008
+++ mount_udfs.new      Mon Apr 28 06:56:32 2008
@@ -22,6 +22,7 @@
      mount  operation,  these are hidden until the file system is
      unmounted.
 
+     udfs supports loopback file mounts: see mount(1M).
 
      If mount is invoked with either special  or  mount_point  as
      the  only  arguments,  mount searches /etc/vfstab to fill in
--- mount_ufs.man       Mon Apr 28 06:57:57 2008
+++ mount_ufs.new       Mon Apr 28 06:56:42 2008
@@ -22,6 +22,7 @@
      mount  operation,  these are hidden until the file system is
      unmounted.
 
+     ufs supports loopback file mounts: see mount(1M).
 
      If mount is invoked with special or mount_point as the  only
      arguments,  mount  will  search  /etc/vfstab  to fill in the


6. Resources and Schedule
    6.4. Steering Committee requested information
        6.4.1. Consolidation C-team Name:
                ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


Reply via email to