tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Deferred freeing of kauth_cred_ts



On Dec,Friday 25 2009, at 6:04 AM, Elad Efrat wrote:

> Hi,
> 
> See diff attached...
> 
> (I'm running it locally plus the socket credentials changes.)

You need some sort of locking there because otherwise it can crash on MP 
systems[2], and I think that you should use condition variable to manage 
sleep/wakeup of kauth_gc_thread, struct kauth_cred needs one mutex and one cv.. 
As a example how mutex/cv can be used for managing task like this please look 
at [1]. 

[1]http://nxr.netbsd.org/source/xref/src/sys/kern/vfs_subr.c#vrele_thread

[2] In a MP system you can have 2 threads accessing same list in time where one 
is adding new HEAD to the list and the second one is removing current HEAD from 
it. This can lead to misbehavior or crash. 

Regards

Adam.



Home | Main Index | Thread Index | Old Index