Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2000 14:37:16 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        arch@FreeBSD.org
Subject:   Re: Can !curproc touch
Message-ID:  <XFMail.001211143716.jhb@FreeBSD.org>
In-Reply-To: <200012112209.PAA29128@usr08.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org> -- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001211143716.jhb>