Date: Tue, 17 Feb 2004 00:32:15 +0100 From: Melvyn Sopacua <freebsd-current@webteckies.org> To: current@FreeBSD.org Cc: Robert Watson <rwatson@FreeBSD.org> Subject: Re: Jails that keep hanging around Message-ID: <200402170032.19490.freebsd-current@webteckies.org> In-Reply-To: <Pine.NEB.3.96L.1040215130356.56481G-100000@fledge.watson.org> References: <Pine.NEB.3.96L.1040215130356.56481G-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-02=_DMVMAsGI+HegWCM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday 15 February 2004 19:18, Robert Watson wrote: > On Sun, 15 Feb 2004, Melvyn Sopacua wrote: > > I have yet to figure out what triggers the bug, but I end up with > > 'running' jails, without any processes. So I thought I'd create 'jld' to > > remove a jail. However - prison_find isn't exported to userland. > > Probably for good reason. > > Jails are reference-counted objects hung off of process credentials, which > are also reference-counted objects. So a jail can't evaporate until the > last credential referencing that object also evaporates. Would you take the patch below? I'm not sure it should be in jls(8) output,= =20 but at least it helps tracking down issues like this. I've tested this patch on this laptop and see no problems with it. =2D-=20 Melvyn =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =46reeBSD sarevok.chello.nl 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Mon Feb 16= =20 19:59:52 CET 2004 =20 root@sarevok.webteckies.org:/usr/obj/usr/src/sys/SAREVOK_NOAPM_NODEBUG i386 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Index: sys/sys/jail.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/sys/jail.h,v retrieving revision 1.19 diff -u -r1.19 jail.h =2D-- sys/sys/jail.h 23 Jan 2004 20:44:26 -0000 1.19 +++ sys/sys/jail.h 16 Feb 2004 23:20:00 -0000 @@ -26,6 +26,7 @@ char pr_path[MAXPATHLEN]; char pr_host[MAXHOSTNAMELEN]; u_int32_t pr_ip; + int pr_refcount; }; #define XPRISON_VERSION 1 =20 Index: sys/kern/kern_jail.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/kern/kern_jail.c,v retrieving revision 1.35 diff -u -r1.35 kern_jail.c =2D-- sys/kern/kern_jail.c 23 Jan 2004 20:44:26 -0000 1.35 +++ sys/kern/kern_jail.c 16 Feb 2004 23:20:01 -0000 @@ -449,6 +449,7 @@ strlcpy(xp->pr_path, pr->pr_path, sizeof(xp->pr_path)); strlcpy(xp->pr_host, pr->pr_host, sizeof(xp->pr_host)); xp->pr_ip =3D pr->pr_ip; + xp->pr_refcount =3D pr->pr_ref; mtx_unlock(&pr->pr_mtx); xp++; } Index: usr.sbin/jls/jls.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/jls/jls.c,v retrieving revision 1.3 diff -u -r1.3 jls.c =2D-- usr.sbin/jls/jls.c 22 Apr 2003 13:24:56 -0000 1.3 +++ usr.sbin/jls/jls.c 16 Feb 2004 23:20:01 -0000 @@ -65,11 +65,12 @@ xp->pr_version !=3D XPRISON_VERSION) errx(1, "Kernel and userland out of sync"); =20 =2D printf(" JID IP Address Hostname Path\n"); + printf(" JID Ref IP Address Hostname =20 Path\n"); for (i =3D 0; i < len / sizeof(*xp); i++) { in.s_addr =3D ntohl(xp->pr_ip); =2D printf("%6d %-15.15s %-29.29s %.74s\n", =2D xp->pr_id, inet_ntoa(in), xp->pr_host, xp->pr_path); + printf("%6d %6d %-15.15s %-29.29s %.74s\n", + xp->pr_id, xp->pr_refcount, inet_ntoa(in), + xp->pr_host, xp->pr_path); xp++; } free(sxp); --Boundary-02=_DMVMAsGI+HegWCM Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBAMVMDOv9JNmfFN5URAjNCAKCy3H3MPTXZqtCvdGjrHIuIqCOdUACeM7eU 789wneBVHkvolrbc9T5+0pM= =uEbZ -----END PGP SIGNATURE----- --Boundary-02=_DMVMAsGI+HegWCM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402170032.19490.freebsd-current>