Date: Thu, 18 Mar 1999 10:21:27 -0800 (PST) From: M.Indlekofer@fz-juelich.de To: freebsd-gnats-submit@freebsd.org Subject: kern/10653: cdevsw_module_handler MOD_UNLOAD problem Message-ID: <19990318182127.7085D1550A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 10653 >Category: kern >Synopsis: cdevsw_module_handler MOD_UNLOAD problem >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 18 10:30:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Michael Indlekofer >Release: 3.1-RELEASE >Organization: Forschungs Zentrum Juelich GmbH >Environment: FreeBSD control10... 3.1-RELEASE FreeBSD 3.1-RELEASE #0: Tue Mar 16 13:31:56 GMT 1999 root@control10.../usr/src/sys/compile/MYKERNEL.3 i386 >Description: A char device driver which uses CDEV_MODULE(xxx_mod,MYMAJOR,xxx_devsw,xxx_handler,0) and wants to prevent an unloading of the module (because some devices he offers are still in use e.g.) has a problem: kldunload -> /sys/kern/kern_conf.c:cdevsw_module_handler which calls for MOD_UNLOAD the function cdevsw_add(...,NULL,NULL) which unregisters our xxx_devsw! AFTERWARDS xxx_handler is asked if he wants to unload,...but it's too late...the xxx_devsw is gone, even for the case we don't want to unload! In my case: A program used a device and kldunload was called. xxx_handler returned EBUSY and kldunload said: can't unload, device busy. The next time the program issued a ioctl for the still open device the system crashed in spec_ioctl (gdb -k ...) with an invalid entry in the cdevsw for MYMAJOR: Fatal trap 12: page fault in kernel mode. >How-To-Repeat: see example above >Fix: /sys/kern/kern_conf.c:???devsw_module_handler should consult the module handler (data->chainevh) FIRST in the case of MOD_UNLOAD whether the module want's to unload before it "kills" the devsw! >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990318182127.7085D1550A>
