Subject: [PATCH] Re: Crash after killing guest processes from the host
From: Grzegorz Nosek <grzegorz.nosek@gmail.com>
Date: Mon, 12 Apr 2010 23:44:10 +0200
Mon, 12 Apr 2010 23:44:10 +0200
2010/4/12 Grzegorz Nosek <grzegorz.nosek@gmail.com>:
> 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.

A rather crude but working patch attached, applies on top of
patch-2.6.27.45-vs2.3.0.36.8.diff, didn't check other versions.

Other important problems (though not so trivially reproducible) are:
  * (pty-related?) locking imbalance on vserver shutdown -- I don't
have logs handy but shutting down a vserver with a screen session
inside (screen on the host, running vserver enter) tends to cause "xid
exited with lock=-19" or something to that effect. The machine seems
to operate quite normally (apart from subsequent "vserver stop"s
hanging after killing all processes) but fails to reboot cleanly.
  * strace'ing a guest process from the host sometimes makes the
machine go down in flames, but I have no logs or further details,
sorry.

Best regards,
 Grzegorz Nosek


From 14b34d32bb4ae3ed2f12ba0e743d9b83d604097b Mon Sep 17 00:00:00 2001
From: Grzegorz Nosek <root@localdomain.pl>
Date: Mon, 12 Apr 2010 23:03:06 +0200
Subject: [PATCH] Prevent signal code from spinning after trying to kill a guest process
from xid 0

---
 kernel/signal.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 76f1f25..a96c6af 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1083,7 +1083,9 @@ retry:
 			 * if we race with de_thread() it will find the
 			 * new leader.
 			 */
-			goto retry;
+			if (vx_check(vx_task_xid(p), VS_WATCH_P | VS_IDENT)) {
+				goto retry;
+			}
 	}
 	rcu_read_unlock();
 
-- 
1.5.6.3