Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Feb 2001 09:48:56 -0800
From:      Peter Wemm <peter@netplex.com.au>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Warner Losh <imp@harmony.village.org>, Jordan Hubbard <jkh@winston.osd.bsdi.com>, John Indra <john@naver.co.id>, freebsd-current@FreeBSD.ORG
Subject:   Re: DEVFS newbie... 
Message-ID:  <200102031748.f13HmuW44694@mobile.wemm.org>
In-Reply-To: <14457.981221808@critter> 

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote:
> In message <200102031729.f13HTL960996@harmony.village.org>, Warner Losh write
    s:
> >In message <82167.981191888@winston.osd.bsdi.com> Jordan Hubbard writes:
> >: Couldn't you also do "mount -t devfs -o nonewdev devfs /home/jail/dev"
> >: and then cd /home/jail/dev ; rm $devices_i_dont_want_in_my_jails ?  It
> >: seems that "read my lips: no new devices" should be an option you can
> >: set from the very initial mount so that people can't also figure out
> >: how to get root, remove a /dev entry and replace it with one of their
> >: own.  Come to think of it, there should also be a -o staticdev option
> >: to disallow *any* changes after the initial mount.  That would make
> >: some of our more paranoid sysadmins happy.
> >
> >My concern is that I usually know what devices I want (/dev/null,
> >/dev/zero, /dev/tty).  That makes it harder to delete all of them not
> >on the list.
> 
> I have seriously been thinking about some way to say something like
> 	mount -t devfs -o jailset /home/jail/dev
> but an elegant implementation evades me at this moment.

As bizzare as it sounds, I like Julian's hack for populating this stuff...
ie: use a hard link to propagate nodes to the jailed /dev.

eg: mount -t devfs -o empty /home/jail/dev
ln /dev/null /home/jail/dev/null
ln /dev/zero /home/jail/dev/zero
...
mount -u -o ro /home/jail/dev

It solves several problems, but is kinda odd as it involves a
cross-filesystem hard link.  This is another way oround the "oops, I didn't
mean to rm /dev/null" - ie:
mount -t devfs /mnt
ln /mnt/null /dev
umount /mnt
The VOP_LINK() stuff has access to the source and destination, so it doesn't
have to guess what do do on incomplete information (eg: fake major number).


On the other hand...  Suppose whiteouts were implemented...

mount -t devfs -o empty /home/jail/dev
cd /home/jail/dev
rm -W null zero log ....
mount -u -o ro /home/jail/dev

ie: start with the initial state as "whiteouts on everything" and then
selectively remove the whiteout for things you actually want... Then freeze
it by flipping on the readonly bit.

> And again, it hinges on an extensible set of mount options.

Yeah.  Maybe pass in arbitary strins "empty" instead of trying to convert
everything to a flag bit?  I've been bothered about this for a while.

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5



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




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