From: Sebastian Roesner (sebastian_at_roesner-online.de)
Date: Wed 05 Feb 2003 - 20:46:05 GMT
Hi,
I possibly found a bug: fakeinit doesn't work.
I patched a vanilla 2.4.20 with patch-2.4.20ctx16. I first thought it
might be because of Herbert Poetzls linux-2.4.20-ctx14-vquota-0.10.diff
patch, but it's the same without it.
http://www.solucorp.qc.ca/changes.hc?projet=vserver&version=0.10 says:
--- snip ---
Here is what fakeinit does in the kernel:
[...]
getppid() done by child process of this process returns 1.
getpid() done by this process returns 1.
[...]
--- snap ---
my getpid.c:
main()
{ printf ("pid: %d\nppid: %d\n",getpid(),getppid()); }
vserver:/vservers/3# /usr/sbin/chcontext --disconnect --flag lock --flag
nproc --flag sched --ctx 3 --hostname vserver3.scheissdomain.de --secure
/usr/lib/vserver/save_s_context /var/run/vservers/3.ctx
/usr/lib/vserver/capchroot . /tmp/getpid
Host name is now vserver3.scheissdomain.de
New security context is 3
pid: 10849
ppid: 1
That's ok, because I didn't set the fakeinit-flag. But shouldn't
vserver:/vservers/3# /usr/sbin/chcontext --disconnect --flag lock --flag
nproc --flag sched --flag fakeinit --ctx 3 --hostname
vserver3.scheissdomain.de --secure /usr/lib/vserver/save_s_context
/var/run/vservers/3.ctx /usr/lib/vserver/capchroot . /tmp/getpid
Host name is now vserver3.scheissdomain.de
New security context is 3
pid: 10857
ppid: 1
return a pid of 1?
The flag is set correctly,
vserver:/vservers/3# /usr/sbin/chcontext --disconnect --flag lock --flag
nproc --flag sched --flag fakeinit --ctx 3 --hostname
vserver3.scheissdomain.de --secure /usr/lib/vserver/save_s_context
/var/run/vservers/3.ctx /usr/lib/vserver/capchroot . cat
/proc/self/status |grep ctxflags
ctxflags: 23
vserver:/vservers/3# /usr/sbin/chcontext --disconnect --flag lock --flag
nproc --flag sched --ctx 3 --hostname vserver3.scheissdomain.de --secure
/usr/lib/vserver/save_s_context /var/run/vservers/3.ctx
/usr/lib/vserver/capchroot . cat /proc/self/status |grep ctxflags
ctxflags: 7
My problem is that setting the fakeinit flag didn't work, the vserver
just says Usage: "init 0123456SsQqAaBbCcUu" when i tried to start the
vserver with "vserver 3 start", because init isn't process 1.
vserver:/vservers/3# /usr/sbin/chcontext --disconnect --flag lock --flag
nproc --flag sched --ctx 3 --hostname vserver3.scheissdomain.de --secure
/usr/lib/vserver/save_s_context /var/run/vservers/3.ctx
/usr/lib/vserver/capchroot . /sbin/init
Host name is now vserver3.scheissdomain.de
New security context is 3
Usage: init 0123456SsQqAaBbCcUu
Btw,
"Now, it goes completely silent. I have not investigated this behavior.
I suspect /sbin/init is opening a new tty (console) and runs the
start-up scripts using that newly open console."
The output is sent to /dev/console, this is hardcoded in src/init.c from
sysvinit.
S. Roesner