Re: mount memory modified after free

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Thu, 20 Oct 2005 08:33:03 +0200
On Wed, Oct 19, 2005 at 06:18:04PM -0400, Brian Fundakowski Feldman wrote:
+> On Sun, Oct 16, 2005 at 09:48:19PM +0200, Pawel Jakub Dawidek wrote:
+> > On Sat, Oct 15, 2005 at 04:00:08PM +0000, Bjoern A. Zeeb wrote:
+> > +> Hi,
+> > +> 
+> > +> I had /dev/ad8s4d mounted read only to /shared and
+> > +> /local/building/ports/shared, then unounted /shared and did a
+> > +> mount -u -o rw /local/building/ports/shared *kaboom*
+> > 
+> > This is known problem. Multiple read-only mounts aren't safe.
+> 
+> Do you mean that multiply-mounting both read-write and read-only isn't
+> safe?  I don't think multiple read-only mounts are unsafe.

Multiple read-only mount are in theory safe, but don't work currently.
The problem was reported by ru_at_ some time ago I analized it and it
is hard to fix. Bascially there is only one place to store mount-point's
vnode in device structure (IIRC) and if you mount the same provider twice,
it will be overwritten and you'll not be able to unmount first file system
without panicing.

The patch I came up with is here:

	http://people.freebsd.org/~pjd/patches/geom_vfs.c.patch

but it has another problem: you can remount one of mounted file system
read-write and I don't know how to stop this.

As a work-around, I think something like this will work:

	# gnop create /dev/ad0s1a
	# gnop create /dev/ad0s1a.nop
	# mount -r /dev/ad0s1a /mnt/foo
	# mount -r /dev/ad0s1a.nop /mnt/foo.bar
	# mount -r /dev/ad0s1a.nop.nop /mnt/foo.baz

(you operate on different devices here)

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd_at_FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Received on Thu Oct 20 2005 - 04:33:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:45 UTC