From: Sam Vilain (sam_at_vilain.net)
Date: Mon 24 Feb 2003 - 18:04:41 GMT
For the keen,
I found the bug with my previous patch.  It comes down to patch fuzz!  One 
ludicrous insertion of diff lines into the wrong place by patch slipped 
through the cracks of my careful poring over its output.  And I mean 
ludicrous - not one of the context lines in kernel/exit.c where patch 
chose to put the added lines were the same.  This has cast great shrouds 
of doubt over the reliability of the diff/patch operation to me, but 
nevermind that :-)
Here is the fix:
diff -urN linux-2.4.21-pre4-ac6-ctx16-rough/kernel/exit.c 
linux-2.4.21-pre4-ac6-ctx16/kernel/exit.c
--- linux-2.4.21-pre4-ac6-ctx16-rough/kernel/exit.c     Tue Feb 25 06:30:15 
2003
+++ linux-2.4.21-pre4-ac6-ctx16/kernel/exit.c   Mon Feb 24 22:14:23 2003
@@ -42,6 +42,8 @@
        current->cmaj_flt += p->maj_flt + p->cmaj_flt;
        current->cnswap += p->nswap + p->cnswap;
        sched_exit(p);
+       sys_release_s_info(p);
+       sys_release_ip_info(p->ip_info);
        p->pid = 0;
        free_task_struct(p);
 }
@@ -66,8 +68,6 @@
                        break;
                }
                if (p->pid == pgrp)
-               sys_release_s_info(p);
-               sys_release_ip_info(p->ip_info);
                        fallback = p->session;
        }
        read_unlock(&tasklist_lock);
The attached patch is against the latest Alan Cox kernel (2.4.21-pre4-ac6; 
I needed it to get DMA working on my KT400 motherboard) + jacque's ctx16 
patch.  It also applies against 2.4.20-ac2 + jacque's ctx16 patch; the 
three failed hunks and one instance of fuzz seem upon first inspection to 
be OK - and so the result will probably work, but I didn't test that.  
I haven't had a chance to thoroughly test this on a system with many real 
vservers yet, but that shocking bug in the last patch I posted is well and 
truly gone.  I'm running the kernel now on my workstation with several 
contexts testing the new code, and all seems to be in order.
I'll post a version with some per-vserver tuning knobs once I figure out 
this whole /proc business :-).  Until then, hack kernel/sys.c
-- Sam Vilain, sam_at_vilain.netThe reason we start a war is to fight a war, win a war, thereby causing no more war! - George W. Bush during the first Presidential debate