From owner-freebsd-current@freebsd.org Thu Feb 11 06:52:39 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 C358CAA5C30 for ; Thu, 11 Feb 2016 06:52:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (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 8D8D630E for ; Thu, 11 Feb 2016 06:52:39 +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 5EBEC1FE023; Thu, 11 Feb 2016 07:52:36 +0100 (CET) Subject: Re: Open Sound System - OSS "soundon" command causes KERNEL PANIC FreeBSD-11 To: Greg Quinlan , "freebsd-current@freebsd.org" References: <56BB0BDB.2090203@selasky.org> <872763758.2494245.1455156152295.JavaMail.yahoo@mail.yahoo.com> From: Hans Petter Selasky Message-ID: <56BC3041.7050203@selasky.org> Date: Thu, 11 Feb 2016 07:54:57 +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: <872763758.2494245.1455156152295.JavaMail.yahoo@mail.yahoo.com> Content-Type: multipart/mixed; boundary="------------080300080004060901070002" 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 06:52:39 -0000 This is a multi-part message in MIME format. --------------080300080004060901070002 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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? --HPS --------------080300080004060901070002 Content-Type: text/x-diff; name="kern_module.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kern_module.diff" Index: sys/kern/kern_module.c =================================================================== --- sys/kern/kern_module.c (revision 295464) +++ sys/kern/kern_module.c (working copy) @@ -214,16 +214,24 @@ module_lookupbyname(const char *name) { module_t mod; + int xlocked; int err; - MOD_LOCK_ASSERT; - + /* + * If the context is not properly locked, apply the proper + * locks here: + */ + xlocked = sx_xlocked(&modules_sx); + if (!xlocked) + MOD_SLOCK; TAILQ_FOREACH(mod, &modules, link) { err = strcmp(mod->name, name); if (err == 0) - return (mod); + break; } - return (NULL); + if (!xlocked) + MOD_SUNLOCK; + return (mod); } module_t --------------080300080004060901070002--