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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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,
but at least it helps tracking down issues like this.
I've tested this patch on this laptop and see no problems with it.
--
Melvyn
=======================================================
FreeBSD sarevok.chello.nl 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Mon Feb 16
19:59:52 CET 2004
root@sarevok.webteckies.org:/usr/obj/usr/src/sys/SAREVOK_NOAPM_NODEBUG i386
=======================================================
Index: sys/sys/jail.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/jail.h,v
retrieving revision 1.19
diff -u -r1.19 jail.h
--- 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
Index: sys/kern/kern_jail.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_jail.c,v
retrieving revision 1.35
diff -u -r1.35 kern_jail.c
--- 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 = pr->pr_ip;
+ xp->pr_refcount = pr->pr_ref;
mtx_unlock(&pr->pr_mtx);
xp++;
}
Index: usr.sbin/jls/jls.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/jls/jls.c,v
retrieving revision 1.3
diff -u -r1.3 jls.c
--- 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 != XPRISON_VERSION)
errx(1, "Kernel and userland out of sync");
- printf(" JID IP Address Hostname Path\n");
+ printf(" JID Ref IP Address Hostname
Path\n");
for (i = 0; i < len / sizeof(*xp); i++) {
in.s_addr = ntohl(xp->pr_ip);
- printf("%6d %-15.15s %-29.29s %.74s\n",
- 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);
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQBAMVMDOv9JNmfFN5URAjNCAKCy3H3MPTXZqtCvdGjrHIuIqCOdUACeM7eU
789wneBVHkvolrbc9T5+0pM=
=uEbZ
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402170032.19490.freebsd-current>
