From owner-freebsd-current@freebsd.org Sat Jan 30 21:09:42 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E98C1A724FA for ; Sat, 30 Jan 2016 21:09:42 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE0EEB81 for ; Sat, 30 Jan 2016 21:09:42 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sat, 30 Jan 2016 21:09:43 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u0UL9ZR2001947; Sat, 30 Jan 2016 14:09:35 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1454188175.32550.3.camel@freebsd.org> Subject: Re: thread-unsafety problems as spl*() ones are NOP From: Ian Lepore To: mokhi , freebsd-current@freebsd.org Date: Sat, 30 Jan 2016 14:09:35 -0700 In-Reply-To: References: Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2016 21:09:43 -0000 On Sat, 2016-01-30 at 18:56 +0330, 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. If you start working on locking in keyboard drivers you might discover there are dragons there. For example... https://lists.freebsd.org/pipermail/svn-src-head/2014-March/056833.html -- Ian