Subject: Re: [vserver] Crash after killing guest processes from the host
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Tue, 13 Apr 2010 20:12:06 +0200

On Tue, Apr 13, 2010 at 08:02:31PM +0200, Herbert Poetzl wrote:
> On Mon, Apr 12, 2010 at 12:00:50PM +0200, Grzegorz Nosek wrote:
> > Hi all,
> 
> > Sending this out before I spend much time researching as maybe 
> > it's a known and fixed problem.
> 
> > When I send a signal (apparently even 0, to check whether the 
> > process is alive) from the host to a guest process, "something bad"
> > happens.
> 
> sounds interesting ... judging from the patch you provided
> it hangs in a loop which constantly tries to send the
> signal and receives -ESRCH (which means, the process was
> not found at this time)
> 
> > It looks like a spinlock isn't being released as all kinds of
> > processes are getting stuck in uninterruptible sleep, loadavg 
> > shoots through the roof and the machine has to be power cycled
> > (sysrq-b works but e.g. sysrq-s never finishes). 
> 
> as I seem to be able to reproduce it here with the following
> sequence:
> 
> # chcontext --xid 42 -- sleep 1000 &
> # kill -USR1 %%
> bash: kill: (<pid>) - No such process
> 
> # kill -USR1 <pid>
> 
> but only if the first kill returns with 'No such process'
> 
> I'll investigate it shortly ...

the following patch should 'fix' the issue, note that
you are not supposed to send signals directly from the 
host context to the guest processes, instead use vkill 
(or the corresponding syscall command) to interact with
processes inside a guest context

http://vserver.13thfloor.at/ExperimentalT/delta-signal-fix01.diff

best,
Herbert

> thanks,
> Herbert
> 
> > There are no errors in dmesg (apart from usual "did lookup hidden
> > devpts" spam). FWIW, lockdep is off.
> 
> > Best regards,
> >  Grzegorz Nosek
> > 
> > ---------------------------------------------------------------------
> > Versions:
> >                    Kernel: 2.6.27.42-00007-gf591647
> >                    VS-API: 0x00020304
> >              util-vserver: 0.30.213; May  9 2007, 20:02:07
> > 
> > Features:
> >                        CC: gcc, gcc (GCC) 4.1.2 20061115 (prerelease)
> > (Debian 4.1.1-21)
> >                       CXX: g++, g++ (GCC) 4.1.2 20061115 (prerelease)
> > (Debian 4.1.1-21)
> >                  CPPFLAGS: ''
> >                    CFLAGS: '-g -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time'
> >                  CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W
> > -fmessage-length=0 -funit-at-a-time'
> >                build/host: i686-pc-linux-gnu/i686-pc-linux-gnu
> >              Use dietlibc: yes
> >        Build C++ programs: yes
> >        Build C99 programs: yes
> >            Available APIs: v13,net,v21
> >             ext2fs Source: e2fsprogs
> >     syscall(2) invocation: alternative
> >       vserver(2) syscall#: 273/glibc
> > 
> > Paths:
> >                    prefix: /usr
> >         sysconf-Directory: /etc
> >             cfg-Directory: /etc/vservers
> >          initrd-Directory: $(sysconfdir)/init.d
> >        pkgstate-Directory: /var/run/vservers
> >           vserver-Rootdir: /vservers