[issue2148] DFBSD v2.13.0.38.g09a36 - Switch to TTY panic

Samuel J. Greear (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Fri Oct 14 01:58:07 PDT 2011

Samuel J. Greear <sjg at evilcode.net> added the comment:

<@tuxillo> I still don't understand why sc_switch_scr() needs to be called locked
<@thesjg_> for accesses to sc probably
<@tuxillo> thesjg_: so that the values that it checks doesn't change in the mean time?=
<@tuxillo> like saying, instead of locking/unlocking in a bunch of places inside sc_switch_scr(), I rather 
lock the whole thing
<@thesjg_> if that's the case..  you can't unlock until around save_kbd_state() in exchange_scr(), but i'm 
not sure its protecting that
<@tuxillo> is that right?
<@thesjg_> not even then
<@thesjg_> you need to figure out what the lock is protecting for sure
<@thesjg_> then you can figure out what to do about it
<@tuxillo> yah true
<@tuxillo> thesjg_: gonna see where it is used to try to find out why
<@thesjg_> it certainly looks like its protecting accesses to the softc
<@thesjg_> yeah, it is
<@tuxillo> hmm
<@thesjg_> so, you need to call kbd_ioctl() without the lock held, but you have two problems there
<@thesjg_> save_kbd_state() (maybe update_kbd_state() too) is called with the lock held sometimes, you know 
that, but you can't just unlock unconditionally until you confirm that it is always called with the lock 
<@thesjg_> if its sometimes called with the lock held, sometimes not, you have to sort that out
<@thesjg_> also, it passes an argument contained in the protected softc into the ioctl, you need to sort 
that out
<aggelos> thesjg_: back to the freebsd 5.x days? :P
<@thesjg_> (make a copy of that member of the softc structure, call the ioctl, copy it back into the 
structure after you re-acquire the lock on return?)
<@thesjg_> aggelos: looks that way
<@thesjg_> i'm not sure if the ioctl modifies the arg or just needs it for reference, so you'll have to 
figure that out
<@thesjg_> tuxillo: armed that with info, you should be able to come up with a fix w/o too much pain
<aggelos> ok, time to reboot into kubuntu 11.10 :/
<@thesjg_> can't help, must sleep  :)

^-- for posterity

status: unread -> chatting

DragonFly issue tracker <bugs at lists.dragonflybsd.org>

More information about the Bugs mailing list