From owner-freebsd-arch Mon Dec 11 14:37: 8 2000 From owner-freebsd-arch@FreeBSD.ORG Mon Dec 11 14:37:07 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id B7AB637B400 for ; Mon, 11 Dec 2000 14:37:06 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by pike.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id eBBMb0E59924; Mon, 11 Dec 2000 14:37:00 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200012112209.PAA29128@usr08.primenet.com> Date: Mon, 11 Dec 2000 14:37:16 -0800 (PST) From: John Baldwin To: Terry Lambert Subject: Re: Can !curproc touch Cc: arch@FreeBSD.org Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 11-Dec-00 Terry Lambert wrote: >> I've got a question about p_cred in proc, specifically p_cred->pc_ucred. In >> several VOP's and other places we use p_cred->pc_ucred (aka p_ucred) as the >> credentials if we don't already have one. The problem arises if another >> process can crfree() that ucred either by a crcopy() or a direct crfree() of >> p_ucred. [ snip ] We already share ucred's, and we already do reference counting for ucred structures. xref crfree()/crcopy()/crhold(), etc. Really, Terry, reading the code and reading the questions in detail would help here. My question is about protecting the p_ucred pointer that is part of struct proc. I'm not trying to lock the ucred itself, I'm trying to figure out how to ensure that the pointer to a ucred I get out of proc is valid when I pass it to a VOP and that it _stays_ valid the entire time. I know that if need be I can do it by protecting the p_ucred pointer with the proc lock and bumping the refcount before passing it down the VOP stack, but if I can get away w/o having to do that I'd like to avoid the cost. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message