What type of locking is needed for ss/sidtab.c?

Chris Wright chris at wirex.com
Tue Jul 23 23:56:16 GMT 2002


* Hiten Pandya (hiten at angelica.unixdaemons.com) wrote:
> Hello.
> 
> Hope this mail finds you in the best of health.  Anyway, I have been
> trying to help out in the TrustedBSD project.  I encountered some code
> in the SEBSD/ss/sidtab.c file, where SIDTAB_LOCK() and SIDTAB_UNLOCK()
> are currently blank macros.
> 
> I saw that in the linux case, it uses safe_up() and safe_down(), which
> are basically "lock" and "unlock" in FreeBSD terminology.  Also, I
> believe according to my experience, that normal MTX_DEF type mutexes
> should do unless the code was using read/write semaphores which it
> doesnt.  And also, safe_up() and safe_down() interface is deprecated in
> Linux 2.5.x series afaik.

The Linux case currently does:

#define SIDTAB_LOCK(s, flags) spin_lock_irqsave(&s->lock,flags)
#define SIDTAB_UNLOCK(s,flags) spin_unlock_irqrestore(&s->lock,flags)

This assumes non-sleeping kmalloc in sidtab_get_sids().

cheers,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-discuss" in the body of the message



More information about the trustedbsd-discuss mailing list