From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH] add mutex to fbdev for fb_mmap locking Date: Tue, 2 Jun 2009 12:11:59 -0700 (PDT) Message-ID: References: <200905282134.n4SLYNwv027999@imap1.linux-foundation.org> <20090530121128.5f04179d.krzysztof.h1@poczta.fm> <20090531162453.dff458cb.krzysztof.h1@poczta.fm> <20090601222413.c2b57c9f.krzysztof.h1@poczta.fm> <20090602200626.1c3486e1.krzysztof.h1@poczta.fm> <20090602195240.0af2f21c@lxorguk.ukuu.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MBZPx-0003SA-0Q for linux-fbdev-devel@lists.sourceforge.net; Tue, 02 Jun 2009 19:13:01 +0000 Received: from smtp1.linux-foundation.org ([140.211.169.13]) by 1b2kzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1MBZPs-0006AY-9G for linux-fbdev-devel@lists.sourceforge.net; Tue, 02 Jun 2009 19:13:00 +0000 In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: Alan Cox Cc: krzysztof.h1@wp.pl, Linux-fbdev-devel , Peter Zijlstra , geert@linux-m68k.org, Andrew Morton , Ingo Molnar , righi.andrea@gmail.com 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 ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get