thread-unsafety problems as spl*() ones are NOP

Alfred Perlstein alfred at
Sun Jan 31 03:23:36 UTC 2016

On 1/30/16 6:56 AM, mokhi wrote:
> Hi.
> in kbd.c there are many places spltty()/splx() used assuming it locks/unlocks.
> though there is bug filed for this, and ive asked in #bsddev, Ive
> preferred to ask and ensure it from here again.
> As these functions are obsoleted now, this assumption is incorrect and
> some places we have thread-unsafely which leads to security problems
> (and/or for example double-free, etc)
> can i use mutex/spin/lock/unlock under where assumed a lock/unlock by
> using spltty()/splx() to patch it?
> Thanks, Mokhi.
Sort of, you have to also make sure to understand any locks being held 
when entering the kbd.c as well as knowing how/when to drop locks using 
msleep() to make it safe.

My understanding is that kdb is locked by GIANT which is why have spls 
as nops is OK (my knowledge may be out of date), still taking out from 
under Giant would be nice as it would be one less place under Giant.

Have a go at it and post patches and let us know how it goes.


More information about the freebsd-ports mailing list