From owner-freebsd-current@freebsd.org Thu Feb 11 10:17:38 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 87861A9FDBE for ; Thu, 11 Feb 2016 10:17:38 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (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 4F6EC69F for ; Thu, 11 Feb 2016 10:17:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9AAA51FE023; Thu, 11 Feb 2016 11:17:35 +0100 (CET) Subject: Re: Open Sound System - OSS "soundon" command causes KERNEL PANIC FreeBSD-11 To: Konstantin Belousov References: <56BB0BDB.2090203@selasky.org> <872763758.2494245.1455156152295.JavaMail.yahoo@mail.yahoo.com> <56BC3041.7050203@selasky.org> <20160211101418.GO91220@kib.kiev.ua> Cc: Greg Quinlan , "freebsd-current@freebsd.org" From: Hans Petter Selasky Message-ID: <56BC604C.4060206@selasky.org> Date: Thu, 11 Feb 2016 11:19:56 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160211101418.GO91220@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed 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: Thu, 11 Feb 2016 10:17:38 -0000 On 02/11/16 11:14, Konstantin Belousov wrote: > On Thu, Feb 11, 2016 at 07:54:57AM +0100, Hans Petter Selasky wrote: >> On 02/11/16 03:02, Greg Quinlan wrote: >>> Hi HPS, >>> Note: Does not happen on FreeBSD 10.1-Stable! >>> >> >> Yes, that's because WITNESS is off in 10.x by default. >> >> Does the attached patch solve your problem? > > No, the patch below does not solve the issue, it only papers over it. > I object against committing this change. For cases where the returned pointer is not deferred, but only checked for a module's presence in the kernel you don't need a lock to protect anything. Maybe make a separate API for this? > > Issue is that, if called unlocked, the result from module_lookupbyname() > could become invalid right after receiving. It is the duty of the caller > of the function to ensure that the result is still valid, and the only > way to achieve it is to own the lock around the whole code region which > calls the function and utilizes its result. > > A bug is in the OSS code. Yes, so why not factor out the solution? Maybe more port KLD's will trip over this? --HPS