Subject: Re: PATCH: init(8) - multiuser under chroot
To: Daniel Carosone <dan@geek.com.au>
From: Jachym Holecek <freza@liberouter.org>
List: tech-userlevel
Date: 08/26/2005 22:10:12
Hello,

sorry for late reply -- I'm offline most of the time now.

> On Tue, May 17, 2005 at 03:56:03PM +0200, Jachym Holecek wrote:
> > The patch below implements this by having init(8) create and watch the
> > "init.root" sysctl node (more details follow in the init.8 part of diff):
> 
> What's the status of this work?  I'd like to see it go into the tree
> and be used.

I've got busy and didn't yet get back to it. I certainly want to gain
some free hacking time, but it's likely to take ${fixnum} weeks...

> IIRC, it was hung up on the question of /etc/ttys and some discussion
> or disagreement on the best way to have that be (re-)read from within
> the chroot.

Alan Barrett recently sent me a patch implementing
"setttyent1(const char *path)". I think this is the right way to solve
the problem.

> There was also at least one preference expressed for
> making the chroot one-way, exec'ing the new init found inside the
> chroot, if possible, rather than something that would be exited on
> return to single-user.

Yes -- my opinion on this remains unchanged. The "multidrop" capability
prove itself useful IRL, I wouldn't like to loose it...

While at it: when the original implementation gets compiled with higher
WARN level, the line

	node.sysctl_data = (void *) "/";

triggers

	/usr/src/sbin/init/init.c: In function `createsysctlnode':
	/usr/src/sbin/init/init.c:1660: warning: cast discards qualifiers \
	    from pointer type

Since this is during CTL_CREATE operation ((void *)sysctl_data contains
initial value of the sysctl node), I'd just do

	#include <sys/cdefs.h>
	...
	node.sysctl_data = __UNCONST("/");

IANAL -- would this be correct usage of __UNCONST? Node's initial value
is (logically) readonly...

	Regards,
		-- Jachym Holecek