From owner-freebsd-current@freebsd.org Sat Jan 30 18:03:06 2016 Return-Path: <owner-freebsd-current@freebsd.org> 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 73702A72525 for <freebsd-current@mailman.ysv.freebsd.org>; Sat, 30 Jan 2016 18:03:06 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 34564AAF for <freebsd-current@freebsd.org>; Sat, 30 Jan 2016 18:03:06 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from <slw@zxy.spb.ru>) id 1aPZrM-000NE6-Fa; Sat, 30 Jan 2016 21:02:56 +0300 Date: Sat, 30 Jan 2016 21:02:56 +0300 From: Slawa Olhovchenkov <slw@zxy.spb.ru> To: mokhi <mokhi64@gmail.com> Cc: freebsd-current@freebsd.org Subject: Re: thread-unsafety problems as spl*() ones are NOP Message-ID: <20160130180256.GT37895@zxy.spb.ru> References: <CAByVWPWuqdtZ-5p2+vGf4v+PjjCBkiTQSsZQ06vk-f=bx_TQrQ@mail.gmail.com> <CAByVWPWQJ1wP95S59SiWWBa0k9j2+u1az-D04_V1voo99CxqCw@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <CAByVWPWQJ1wP95S59SiWWBa0k9j2+u1az-D04_V1voo99CxqCw@mail.gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: <locally generated> X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current <freebsd-current.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-current>, <mailto:freebsd-current-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current/> List-Post: <mailto:freebsd-current@freebsd.org> List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-current>, <mailto:freebsd-current-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sat, 30 Jan 2016 18:03:06 -0000 On Sat, Jan 30, 2016 at 06:56:00PM +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? If other parts of kernel sources, locked by spltty()/splx(), don't interacted by called function and accessed data. Cuurently, in stable, spltty used in 27 files and splx in 101 files.