Re: mnt_dirname revisited (chroot)

From: Guest section DW (dwguest@win.tue.nl)
Date: Sun Jan 16 2000 - 12:40:02 EST


On Sun, Jan 16, 2000 at 01:27:46PM +0100, almesber@lrc.di.epfl.ch wrote:

> Well, I found an approach to fix this:

> Since anybody who reads /<proc>/mounts ...

Remark 1:

/proc/mounts is a semi-misfeature that you need not
worry too much about when you design a change.

No serious programs using /proc/mounts can exist.
We just have "cat /proc/mounts" as a convenient way
to check which filesystems are mounted. Perhaps "df"
will read it.

The idea of /proc/mounts is that it can be a replacement for
/etc/mtab, that is accurate by definition, unlike mtab, which
cannot be updated when it is on a read-only filesystem, and
has other problems. Unfortunately, the code for /proc/mounts
is rather weak. For example, after "mount /dev/foo a", I
find the line "/dev/foo a ext2 rw 0 0" in /proc/mounts
(but "/dev/foo /home/aeb/a ext2 rw 0 0" in /etc/mtab).
Also, mount will escape spaces in directory names, and
use "a\040b", but /proc/mounts doesnt, so that it is impossible
to parse the line "a b c ext2 rw 0 0" in /proc/mounts.
There are further problems.

In other words, an improved /proc/mounts need not mimic the
current one very precisely.

Remark 2:

In a chroot jail one may have a /proc mounted.
Often one prefers not to have things from outside visible there.
Certainly one prefers not to have things from outside accessible there.
Thus, it is a bad idea to introduce paths in the proc filesystem
that are aliases for things outside.

>From this point of view /proc/mounts should probably not list
anything that is not visible from the process' current root.
In particular, you avoid inventing notations like 03:03;
if there is no name then the thing is not listed at all.

> /dev/hda1 /foo ext2 rw 0 0 -> it's on /foo
> /dev/hda2 03:03/bar ext2 rw 0 0 -> it's on /proc/mount/03:03/bar
> (detection: path doesn't begin with "/")

[as noted: presently there is no guarantee that names begin with /]

> Disadvantage of the second approach: each application that reads
> /proc/mounts needs to be aware of the new convention.

> Opinions ? Strong objections to /proc/mount/<kdevname> in general ?

I think it is unnecessary to make /proc/mount/<kdevname>.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:14 EST