Created attachment 241357 [details] coredump After installing the oss package, a kernel panic occurs every time the computer is shut down. Steps to reproduce: - Fresh install of FreeBSD 13.1-RELEASE. Tested this with bot UFS and ZFS filesystems which does not make a difference. - Build and install a custom Kernel with all sound support removed as instructed by the audio/oss port. - Install the oss package - set oss_enable="YES" in /etc/rc.conf - Reboot - Then the kernel panic occurs after the shutdown command is give (core dump attached) - The kernel panic can also be provoked by first shutting down oss (# service oss stop) and then shutting down mixer(8) (#service mixer stop) The sound card (ASUS Xonar D2X) does work with the oss drivers. dmesg() notes that the Open Sound System is started. Only other message related with this issue is "pci0:6:4:0: Device leaked IRQ resources". Hardware in my setup: Motherboard: Asus Z9PA-D8 motherboard CPU:2x Intel Xeon E5-2697 v2 @ 2.70GHz GPU: NVIDIA GeForce GTX 1080 ASUS Xonar D2X Workaround: Because the panic occurs whenever mixer(8) is shut down after oss is shut down, the following workaround will prevent the panic from occurring: add "# REQUIRE: oss" to /etc/rc.d/mixer, which ensures mixer(8) shuts down before oss. See also the forum thread discussing this https://forums.freebsd.org/threads/kernel-panic-at-shutdown-after-installing-oss-with-proposed-fix.88655/
Thanks for tracing this. Does it also work if instead of the REQUIRE in rcd./mixer you put BEFORE: mixer in /usr/local/etc/rc.d/Oss?
(In reply to Chris Rees from comment #1) I just tested this, and yes that also works!
Thanks! I'll sort this.
(In reply to Chris Rees from comment #3) You're welcome. I'm happy to help!
it's wild that this wrong ordering is allowed to just crash the kernel what's going on there? is this software just so badly written? or is is our kernel not resilient enough?
There's always a risk that third party modules might be dodgy. I've had to fix a few crashes - it used to panic the system if sound.ko was loaded too! It's very niche; only Asus Xonar users use this these days, so if anyone were looking at fixing it I'd suggest their efforts may be better directed at making a 8788 FreeBSD sound driver :)
Committed, thanks!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4353081bac0cb82f0590bf81800ac507f0cb75dd commit 4353081bac0cb82f0590bf81800ac507f0cb75dd Author: Marten <martenvdberg@hotmail.com> AuthorDate: 2023-04-13 08:10:55 +0000 Commit: Chris Rees <crees@FreeBSD.org> CommitDate: 2023-04-13 08:16:00 +0000 audio/oss: Save mixer before unloading module After installing the oss package, a kernel panic occurs every time the computer is shut down. This is because the mixer RC script tries to save the mixer values after the OSS module is unloaded. We can avoid this by making OSS unload after this is done. [crees] While here, pet rclint. PR: ports/270709 audio/oss/Makefile | 2 +- audio/oss/files/oss.in | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-)