Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Aug 2009 11:58:37 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Rick Macklem <rmacklem@uoguelph.ca>
Cc:        Robert Watson <rwatson@FreeBSD.org>, jeff@FreeBSD.org, "Bjoern A. Zeeb" <bz@FreeBSD.org>, freebsd-current@FreeBSD.org, kib@FreeBSD.org, Navdeep Parhar <np@FreeBSD.org>, Larry Rosenman <ler@lerctr.org>, lstewart@FreeBSD.org
Subject:   Re: reproducible panic in netisr
Message-ID:  <4A7B27DD.20503@elischer.org>
In-Reply-To: <Pine.GSO.4.63.0908061131220.3240@muncher.cs.uoguelph.ca>
References:  <20090804225806.GA54680@hub.freebsd.org>	<20090805054115.O93661@maildrop.int.zabbadoz.net>	<20090805063417.GA10969@doormat.home>	<alpine.BSF.2.00.0908060011490.59996@fledge.watson.org>	<alpine.BSF.2.00.0908060834120.21318@thebighonker.lerctr.org>	<alpine.BSF.2.00.0908061508520.62916@fledge.watson.org>	<Pine.GSO.4.63.0908061038120.22077@muncher.cs.uoguelph.ca>	<4A7AF25D.40608@elischer.org> <Pine.GSO.4.63.0908061131220.3240@muncher.cs.uoguelph.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Rick Macklem wrote:
> 
> 
> On Thu, 6 Aug 2009, Julian Elischer wrote:
> 
>> Rick Macklem wrote:
>>>
>>>
>>> On Thu, 6 Aug 2009, Robert Watson wrote:
>>>
>>>> other places where we have very strong alignment requirements on 
>>>> i386/amd64, such as the td_ucred pointer that we check for change on 
>>>> system calls/traps to see if we need to refresh the thread's 
>>>> credential from the process credential.
>>>>
>>> Does this imply that the krpc/nlm/nfs hack of:
>>>     oldcred = td->td_ucred;
>>>     td->td_ucred = "some other cred ptr, such as the mount one"
>>>     ...
>>>     td->td_ucred = oldcred;
>>>
>>> could be dangerous?
>>>
>>> Maybe it should be converted to code that replaces the contents instead
>>> of replacing the *cred? (Variants of the above live in a bunch of places
>>> in the krpc, nlm and nfs code, due to the fact that the socket functions
>>> use td->td_ucred in various places.)
>>
>> no, creds are read-only .. you never change a cred.
>> You alwasy make a new one ans use it, becasue you may be shareing your 
>> cred with hundreds of other sibling threads or processes. (they are 
>> refcounted)
>>
> Righto, yes. So does that imply that the alignment provided by crget()
> { which uses malloc() } is sufficient for td->td_ucred or is td->td_ucred
> a special case?

It should be enough.

> 
> rick
> ps: The above hack, which came up in a separate discussion yesterday,
>     isn't gonna be easy to get rid of, imho. A whole bunch of network
>     related functions use td->td_ucred and the only fix I can see would
>     be to add "*cred" arguments to them all, so that the krpc/nlm/nfs
>     code could pass the correct *cred in. (It is set to the one used at
>     mount time for network reconnects, etc.)

we should probably do the right thign refcount-wise for the ucred
but refcount (atomic) ops are expensive.

> 
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A7B27DD.20503>