Re: mount(2) bug found

Chris Wedgwood (chris@cybernet.co.nz)
Tue, 16 Jun 1998 19:46:54 +1200


On Tue, Jun 16, 1998 at 09:21:26AM +0200, Rik van Riel wrote:
>
> It _is_ a bug. Just look at the following scenario:
>
> mirkwood:# df
> /dev/root / <blahblahblah>
> /dev/sda4 /stampede <blahblahblah>
> mirkwood:# chroot /stampede /bin/bash
> chroot:# mount /dev/sda1 /mnt
> chroot:# mount -t proc none /proc
> <flip to other console>
> mirkwood:# cat /proc/mounts
> /dev/root / <blah>
> /dev/sda4 /stampede <blah>
> none /proc <blah>
> /dev/sda1 /mnt <blah> <-- mounted on /stampede/mnt
> none /proc <blah> <-- mounted on /stampede/proc
>
> So you see, it _is_ a bug... This is mainly because
> programs like 'df' depend on the fact that the FSes
> are correctly listed.
> The above setup clearly breaks 'df' and other programs.

df uses (and should use) /etc/fstab and getmntent(3).

IMO /proc/mounts is not meant for lusers to twiddle with, but more for
admins. and system tools, as it can be kernel version dependant. Nor it it
portable.

If df uses /proc/mounts, IMO, _it_ is broken.

This all depends on what is considered to be the right smeantics for
/proc/mounts, and IMO, df doesn't come into the equation.

-cw

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu