From: Linus T. <tor...@li...> - 2009-06-02 19:13:01
|
On Tue, 2 Jun 2009, Linus Torvalds wrote: > > I thought we already always copied things to a buffer (for conversion > reasons, ie doing the whole "ktermios<->random-user-termios-of-the-day" > thing), but I guess I was wrong. Ahh. We do it in the other direction (ie set_termios), and for some limited form of to-user (get_sgttyb, get_tchars etc) but apparently not for TCGETS*. There's a few other odd corners there too. Look at TCGETA - it doesn't get the lock at all. Why are TCGETS* and TCGETA so different? I wonder if we even really need that lock for TCGETS*. We clearly don't do it for "struct termio" (TCGETA). The same imbalance seems to exist for get_termiox vs set_termiox. The "set" part does the nice "copy outside the lock", while the "get" part copies to user space inside the lock. And then there is TIOCGSOFTCAR, which is just insane, and apparently gets the lock in order to just test _one_ bit (C_CLOCAL). Never mind that if something is changing it, we really don't care _which_ case we return, so the lock is likely pointless to begin with (can "termios" actually change as a pointer?). But then does the user space access with the lock held. Linus |