From owner-freebsd-jail@FreeBSD.ORG Sun Aug 10 00:13:15 2008 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E2DF106566B for ; Sun, 10 Aug 2008 00:13:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by mx1.freebsd.org (Postfix) with ESMTP id BD50D8FC0C for ; Sun, 10 Aug 2008 00:13:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so1962651fgb.35 for ; Sat, 09 Aug 2008 17:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=KEeVgeYGTtMlayn8+hLhysmrv4a11oKtiINiA5ZQBvk=; b=K2JTBwMNXyFHOVm+DwAMiBOcrxiFncveYmGH+9pkSS2GF1Mkysd7hUlh9Ft6FLgKfD th5PrER4hjftq+wjXm7CaKaJK0rsWEuQiWwECfHb9dIaLkO8LpiSsXS9BYmjzqMe+RJw MToFHnA88T54kk8cl/gMbOzaC7XVYMBe4wvNc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=B/grK8sB/uA7vDWlRag5k+t0UFFOEDuHpmkBBSEuPubY74FNEEtYaz6tcMTPKofQxK mSBWk/Z3hjOCm31MG3Wtp5/Di5OLSznjzr3auoIzLzx8J3QnFtTf0VLsc0lQGr3Lz5A9 3UITW4YTgd12KpzabSaz1ZZy/4P3hyK6ymOOE= Received: by 10.86.82.16 with SMTP id f16mr5410201fgb.16.1218325640513; Sat, 09 Aug 2008 16:47:20 -0700 (PDT) Received: from gmail.com ( [77.236.1.49]) by mx.google.com with ESMTPS id 4sm6193946fge.5.2008.08.09.16.47.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 09 Aug 2008 16:47:19 -0700 (PDT) Date: Sun, 10 Aug 2008 01:47:17 +0200 From: Mateusz Guzik To: "Bjoern A. Zeeb" Message-ID: <20080809234717.GC13799@skucha.home.aster.pl> References: <200808081740.m78He4bc084276@freefall.freebsd.org> <20080808184224.H88849@maildrop.int.zabbadoz.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: <20080808184224.H88849@maildrop.int.zabbadoz.net> User-Agent: Mutt/1.4.2.3i Cc: freebsd-jail@freebsd.org Subject: Re: kern/126368: Running ktrace/kdump in jail leads to stale jails X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2008 00:13:15 -0000 --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline On Fri, Aug 08, 2008 at 06:43:38PM +0000, Bjoern A. Zeeb wrote: > >The following reply was made to PR kern/126368; it has been noted by GNATS. > > > >From: "Mateusz Guzik" > >To: bug-followup@freebsd.org > >Cc: > >Subject: Re: kern/126368: Running ktrace/kdump in jail leads to stale jails > >Date: Fri, 8 Aug 2008 19:30:22 +0200 > > > >Err, I made a mistake. crfree() will be called in case of failure > >(loop starting at line 959), so the following patch should be ok: > > > >--- sys/kern/kern_ktrace.c.orig 2008-08-08 16:37:45.000000000 +0200 > >+++ sys/kern/kern_ktrace.c 2008-08-08 19:25:16.000000000 +0200 > >@@ -933,12 +933,14 @@ > > error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred); > > VOP_UNLOCK(vp, 0, td); > > vn_finished_write(mp); > > vrele(vp); > > VFS_UNLOCK_GIANT(vfslocked); > >- if (!error) > >+ if (!error) { > >+ crfree(cred); > > return; > >+ } > > that sounds more plausible w/o seeing the surrounding code. I had > wondered already earlier today when I was pointed at. > > I'll look into this. > Sorry for the noise -- the first patch was right. ;) ktr_writerequest() is called multiple times and it _always_ calls crhold(), so crfree() must be called before it returns (even in case of failure). Also, in this function one can find: [..] crhold(cred) [..] if (vp == NULL) { KASSERT(cred == NULL, ("ktr_writerequest: cred != NULL")); return; } `Normal' kernel might leak credentials in this case, so I believe crfree() should be added there too. Thanks, and again, sorry for the noise. -- Mateusz Guzik --HcAYCG3uE/tztfnV Content-Type: text/x-diff; charset=iso-8859-2 Content-Disposition: attachment; filename="kern_ktrace.diff" --- sys/kern/kern_ktrace.c.orig 2008-08-08 16:37:45.000000000 +0200 +++ sys/kern/kern_ktrace.c 2008-08-10 01:42:07.000000000 +0200 @@ -889,10 +889,12 @@ * request, so just drop it. Make sure the credential and vnode are * in sync: we should have both or neither. */ if (vp == NULL) { KASSERT(cred == NULL, ("ktr_writerequest: cred != NULL")); + if (cred != NULL) + crfree(cred); return; } KASSERT(cred != NULL, ("ktr_writerequest: cred == NULL")); kth = &req->ktr_header; @@ -933,10 +935,11 @@ error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred); VOP_UNLOCK(vp, 0, td); vn_finished_write(mp); vrele(vp); VFS_UNLOCK_GIANT(vfslocked); + crfree(cred); if (!error) return; /* * If error encountered, give up tracing on this vnode. We defer * all the vrele()'s on the vnode until after we are finished walking --HcAYCG3uE/tztfnV-- From owner-freebsd-jail@FreeBSD.ORG Sun Aug 10 08:20:04 2008 Return-Path: Delivered-To: freebsd-jail@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E3D71065673 for ; Sun, 10 Aug 2008 08:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 34B478FC13 for ; Sun, 10 Aug 2008 08:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7A8K3AS062261 for ; Sun, 10 Aug 2008 08:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7A8K38E062260; Sun, 10 Aug 2008 08:20:03 GMT (envelope-from gnats) Date: Sun, 10 Aug 2008 08:20:03 GMT Message-Id: <200808100820.m7A8K38E062260@freefall.freebsd.org> To: freebsd-jail@FreeBSD.org From: =?ISO-8859-2?Q?Nejc_=A9koberne?= Cc: Subject: Re: kern/126368: [jail] Running ktrace/kdump in jail leads to stale jails X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?ISO-8859-2?Q?Nejc_=A9koberne?= List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2008 08:20:04 -0000 The following reply was made to PR kern/126368; it has been noted by GNATS. From: =?ISO-8859-2?Q?Nejc_=A9koberne?= To: bug-followup@FreeBSD.org, nejc@skoberne.net Cc: Subject: Re: kern/126368: [jail] Running ktrace/kdump in jail leads to stale jails Date: Sun, 10 Aug 2008 10:12:48 +0200 I have tried the submitted patch but I think it behaves strangely. I still see the stale jail, but only for about a minute after I have stopped it. After that, "jls" doesn't display the jail anymore. This about-one-minute delay is not present if I don't "ktrace" in the jail. From owner-freebsd-jail@FreeBSD.ORG Sun Aug 10 08:50:04 2008 Return-Path: Delivered-To: freebsd-jail@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60795106566C for ; Sun, 10 Aug 2008 08:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3800B8FC1A for ; Sun, 10 Aug 2008 08:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7A8o41w065169 for ; Sun, 10 Aug 2008 08:50:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7A8o4fu065168; Sun, 10 Aug 2008 08:50:04 GMT (envelope-from gnats) Date: Sun, 10 Aug 2008 08:50:04 GMT Message-Id: <200808100850.m7A8o4fu065168@freefall.freebsd.org> To: freebsd-jail@FreeBSD.org From: =?ISO-8859-2?Q?Nejc_=A9koberne?= Cc: Subject: Re: kern/126368: [jail] Running ktrace/kdump in jail leads to stale jails X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?ISO-8859-2?Q?Nejc_=A9koberne?= List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2008 08:50:04 -0000 The following reply was made to PR kern/126368; it has been noted by GNATS. From: =?ISO-8859-2?Q?Nejc_=A9koberne?= To: bug-followup@FreeBSD.org, nejc@skoberne.net Cc: Subject: Re: kern/126368: [jail] Running ktrace/kdump in jail leads to stale jails Date: Sun, 10 Aug 2008 10:47:51 +0200 Sorry, please ignore the previous post, my problem of "the delay" seems to be unrelated with "ktrace-in-jail" issue. I guess this patch fixes the problem after all. From owner-freebsd-jail@FreeBSD.ORG Mon Aug 11 11:06:59 2008 Return-Path: Delivered-To: freebsd-jail@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC8CF106574F for ; Mon, 11 Aug 2008 11:06:59 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C78F38FC32 for ; Mon, 11 Aug 2008 11:06:59 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7BB6xqc047235 for ; Mon, 11 Aug 2008 11:06:59 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7BB6xGA047231 for freebsd-jail@FreeBSD.org; Mon, 11 Aug 2008 11:06:59 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 11 Aug 2008 11:06:59 GMT Message-Id: <200808111106.m7BB6xGA047231@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-jail@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-jail@FreeBSD.org X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2008 11:07:00 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- s kern/89528 jail [jail] [patch] impossible to kill a jail o kern/119842 jail [smbfs] [jail] "Bad address" with smbfs inside a jail o kern/126368 jail [jail] Running ktrace/kdump in jail leads to stale jai 3 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o bin/32828 jail [jail] w(1) incorrectly handles stale utmp slots with o kern/68192 jail [quotas] [jail] Cannot use quotas on jailed systems o kern/72498 jail [libc] [jail] timestamp code on jailed SMP machine gen o kern/74314 jail [resolver] [jail] DNS resolver broken under certain ja o kern/84215 jail [jail] [patch] wildcard ip (INADDR_ANY) should not bin o kern/89989 jail [jail] [patch] Add option -I (ASCII 73) PID to specif o kern/97071 jail [jail] [patch] add security.jail.jid sysctl o bin/99566 jail [jail] [patch] fstat(1) according to specified jid o kern/120753 jail [jail] Zombie jails (jailed child process exits while 9 problems total. From owner-freebsd-jail@FreeBSD.ORG Fri Aug 15 00:44:45 2008 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 023A41065671 for ; Fri, 15 Aug 2008 00:44:45 +0000 (UTC) (envelope-from alexus@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174]) by mx1.freebsd.org (Postfix) with ESMTP id C0BEB8FC0A for ; Fri, 15 Aug 2008 00:44:44 +0000 (UTC) (envelope-from alexus@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so651836wfg.7 for ; Thu, 14 Aug 2008 17:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=eJVXTACf4JReQ0xON1ifu5a6rLNKreBexwa57I6UHAM=; b=kiJpbl82VMtLwic/t80SmqAgKsSUM7doAEHmWR0tSyPxrp4fwULd6jTq7NGdyLOXEz 6y9AcOhNoJ0HSremF7XfscObFxER1cbDy1O0bnC/kDnArnL0CliSZtX11dDFou7EcRZP K4itsd2iz+36NTKSWggVl1aLSv17WoI7yiz5Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=gya/kdDajJw2a+NszJxE5P6Ld0nsuZvqNH8GnGaAHdijecC4zYOMXexTpVcm5Rw4NG JwT7QuvDhxmpoe1YZBHu0U8+zGb8b1uEIRLbuRrFh7slafeUdmDpUaSrCm0615MBGiXJ iQGdSdhhVxsEdEcvEnZMDaxVGQ0EtQnD29ufQ= Received: by 10.142.172.12 with SMTP id u12mr761671wfe.35.1218759398389; Thu, 14 Aug 2008 17:16:38 -0700 (PDT) Received: by 10.142.233.3 with HTTP; Thu, 14 Aug 2008 17:16:38 -0700 (PDT) Message-ID: <6ae50c2d0808141716g5c213fe9ha688c7b544a0fb35@mail.gmail.com> Date: Thu, 14 Aug 2008 20:16:38 -0400 From: alexus To: "Mateusz Guzik" In-Reply-To: <20080809234717.GC13799@skucha.home.aster.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200808081740.m78He4bc084276@freefall.freebsd.org> <20080808184224.H88849@maildrop.int.zabbadoz.net> <20080809234717.GC13799@skucha.home.aster.pl> Cc: freebsd-jail@freebsd.org, "Bjoern A. Zeeb" Subject: Re: kern/126368: Running ktrace/kdump in jail leads to stale jails X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2008 00:44:45 -0000 where can I get latest patch? that I can apply to 7.0-RELEASE-p3 ? 2008/8/9 Mateusz Guzik : > On Fri, Aug 08, 2008 at 06:43:38PM +0000, Bjoern A. Zeeb wrote: >> >The following reply was made to PR kern/126368; it has been noted by GNATS. >> > >> >From: "Mateusz Guzik" >> >To: bug-followup@freebsd.org >> >Cc: >> >Subject: Re: kern/126368: Running ktrace/kdump in jail leads to stale jails >> >Date: Fri, 8 Aug 2008 19:30:22 +0200 >> > >> >Err, I made a mistake. crfree() will be called in case of failure >> >(loop starting at line 959), so the following patch should be ok: >> > >> >--- sys/kern/kern_ktrace.c.orig 2008-08-08 16:37:45.000000000 +0200 >> >+++ sys/kern/kern_ktrace.c 2008-08-08 19:25:16.000000000 +0200 >> >@@ -933,12 +933,14 @@ >> > error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred); >> > VOP_UNLOCK(vp, 0, td); >> > vn_finished_write(mp); >> > vrele(vp); >> > VFS_UNLOCK_GIANT(vfslocked); >> >- if (!error) >> >+ if (!error) { >> >+ crfree(cred); >> > return; >> >+ } >> >> that sounds more plausible w/o seeing the surrounding code. I had >> wondered already earlier today when I was pointed at. >> >> I'll look into this. >> > > Sorry for the noise -- the first patch was right. ;) > > ktr_writerequest() is called multiple times and it _always_ calls > crhold(), so crfree() must be called before it returns (even in case of > failure). > > Also, in this function one can find: > > [..] > crhold(cred) > [..] > if (vp == NULL) { > KASSERT(cred == NULL, ("ktr_writerequest: cred != NULL")); > return; > } > > `Normal' kernel might leak credentials in this case, so I believe crfree() should be added there too. > > Thanks, and again, sorry for the noise. > -- > Mateusz Guzik > > _______________________________________________ > freebsd-jail@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-jail > To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org" > > -- http://alexus.org/