Re: Jails that keep hanging around

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Mon, 16 Feb 2004 10:00:29 -0500 (EST)
On Mon, 16 Feb 2004, Pawel Jakub Dawidek wrote:

> Yeah, there is a cred leak and I am the one who track it down!:) 
> 
> 	http://garage.freebsd.pl/patches/tcp_subr.c.patch
> 
> Don't do 'jls' just after killing 'nc', because cred will be freed after
> timeout, so wait few minutes and then try 'jls'. 
> 
> If there is no objections I'm going to commit it tomorrow. 

Nice catch -- looks like that has been there since the introduction of
reduced state time wait in early 2003.  That was never merged to RELENG_4,
so isn't present there.  One request -- NULL the tw_cred pointer as is
done with the other fields, so that if there is a failure to initialize it
propery later, we get a panic instead of something less predictable.

As you point out, this is actually a relatively benign leak in most
systems, because credentials are reference counted copy-on-write, and
relatively small data structures.  In most cases, there are relatively few
unique credentials floating around the system, and they are heavily
reused.  Each time a jail is created, it results in several credential
modifications (one for the jail system call, then the setuid/etc calls
during the setup of processes in the jails), increasing the chances a leak
will be noticed, especially now that we have a tool to list instances of
ojects referenced by credentials.

Thanks,

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert_at_fledge.watson.org      Senior Research Scientist, McAfee Research
Received on Mon Feb 16 2004 - 06:00:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:43 UTC