From nobody@FreeBSD.org  Mon May 31 13:50:37 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0484C16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2004 13:50:37 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id F25A143D2D
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2004 13:50:36 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i4VKoU1M076085
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2004 13:50:30 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i4VKoUZC076074;
	Mon, 31 May 2004 13:50:30 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200405312050.i4VKoUZC076074@www.freebsd.org>
Date: Mon, 31 May 2004 13:50:30 -0700 (PDT)
From: Matthew Emmerton <matt@gsicomp.on.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kldunload snd causes machine to trap
X-Send-Pr-Version: www-2.3

>Number:         67426
>Category:       kern
>Synopsis:       panic: kldunload snd causes machine to trap
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    tanimura
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 31 14:00:46 PDT 2004
>Closed-Date:    Fri Jul 16 08:01:02 GMT 2004
>Last-Modified:  Fri Jul 16 08:06:11 GMT 2004
>Originator:     Matthew Emmerton
>Release:        4.10-STABLE
>Organization:
GSI Computer Service
>Environment:
FreeBSD penelope.gsicomp.on.ca 4.10-STABLE FreeBSD 4.10-STABLE #4: Sun May 30 16:46:28 EDT 2004     root@penelope.gsicomp.on.ca:/usr/obj/usr/src/sys/PENELOPE.20040505.01  i386

>Description:
Doing a 'kldunload snd' causes the machine to panic (kernel trap 12).

This has been discussed on various mailing lists, and the "workaround" is to add "device pcm" in the kernel config.  This avoids the problem since the system no longer uses the 'pcm' module.

The *real* problem is that the 'sbc' module does not properly identify its dependency on the 'pcm' module, and therefore, when kldunloading the 'snd' mega-module, 'pcm' may be unloaded before 'sbc' and will cause the trap.

This was found (and fixed) in DragonFlyBSD 4 months ago.
http://www.shiningsilence.com/mailarchive/bugs/2004-January/0403.html

>How-To-Repeat:
On a machine *without* "device pcm" in the kernel, do the following:

# kldload snd
# kldunload snd
< kernel panic >

>Fix:
Against -stable (codebase I'm using):

--- sys/modules/sound/driver/sbc/Makefile.orig  Sun May 30 19:25:46 2004
+++ sys/modules/sound/driver/sbc/Makefile       Sun May 30 19:25:39 2004
@@ -4,5 +4,6 @@
 KMOD           = snd_sbc
 SRCS           = device_if.h bus_if.h isa_if.h pci_if.h
 SRCS           += sbc.c
+KMODDEPS       = snd_pcm

 .include <bsd.kmod.mk>

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tanimura 
State-Changed-When: Fri Jul 16 07:59:24 GMT 2004 
State-Changed-Why:  
Fixed in src/sys/modules/sound/driver/sbc/Makefile rev 1.1.2.4, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=67426 
Responsible-Changed-From-To: freebsd-bugs->tanimura 
Responsible-Changed-By: tanimura 
Responsible-Changed-When: Fri Jul 16 08:05:53 GMT 2004 
Responsible-Changed-Why:  
I have taken care of this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=67426 
>Unformatted:
