Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 May 2002 20:33:40 -0700
From:      "Crist J. Clark" <crist.clark@attbi.com>
To:        arch@freebsd.org
Subject:   df(1) Broken in jail(8)
Message-ID:  <20020503203340.A74245@blossom.cjclark.org>

next in thread | raw e-mail | index | archive | help
The df(1) utility is broken in jail(8) environments. I could
understand if it was totally broken, there are things you can't and
shouldn't be able to do in a jail(8). However, df(1) behavior is
inconsistent.

The getmntinfo(3) function (via the getfsstat(2) call) works in a
jail(8). When the output is generated from its output, df(1) works
(but the info isn't offset to the jail(8)'s root). However, when one
specifies individual filesystems or uses the '-t' option, the
information on the mount point is gathered using a statfs(2)
call. Since this takes a path, which will be offset to the jail(8)
root when processed, as an argument, the results are basically
broken.

There are several ways to fix this, and I've come here for
opinions.

  1) One can not use statfs(2) for '-t,' but stick with
     getmntinfo(3)'s info only. But it makes some sense to stick with
     statfs(2) for file aguments provided to df(1). This is fairly
     easy to implement.

  2) One can remove the ability to use df(1) at all in a jail(8). It
     could be argued that there is no real reason to be able to use
     things like getfsstat(2) or statfs(2) in a jail(8) (but what else
     might this break?). This is easy to do.

  3) One can fix getfstat(2) and statfs(2) so they are
     "jail(8)-aware." That is, getfstat(2) knows only to return info
     on filesystems mounted at or above the jail(8)'s root. Both calls
     learn how to offset their mountpoint names to the jail root. This
     is harder.

And is anyone already working on this?
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020503203340.A74245>