Bug 271515 - emulators/virtualbox-ose-additions: crash on 14.0-CURRENT upon kldload vboxguest
Summary: emulators/virtualbox-ose-additions: crash on 14.0-CURRENT upon kldload vboxguest
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Virtualbox Team (Nobody)
URL:
Keywords: crash, needs-qa
Depends on:
Blocks:
 
Reported: 2023-05-19 16:24 UTC by groenveld
Modified: 2023-09-25 20:39 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (vbox)


Attachments
Proposed device_probe_and_attach FIX (518 bytes, patch)
2023-05-25 19:53 UTC, Alex Bylund
no flags Details | Diff
emulators/virtualbox-ose-additions: make package log (16.20 KB, application/x-troff-man)
2023-07-18 22:53 UTC, groenveld
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description groenveld 2023-05-19 16:24:54 UTC
$ uname -srvUK
FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n263002-743516d51fa7: Thu May 18 08:06:33 UTC 2023     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC 1400088 1400088

console message below.
John
groenveld@acm.org

vboxguest0 port 0xc140-0xc15f mem 0x88000000-0x883fffff,0x88620000-0x88623fff irq 20 at device 4.0 on pci0
panic: mutex Giant owned at /usr/src/sys/kern/kern_synch.c:501
cpuid = 0
time = 1684498382
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0095cbd590
vpanic() at vpanic+0x152/frame 0xfffffe0095cbd5e0
panic() at panic+0x43/frame 0xfffffe0095cbd640
__mtx_assert() at __mtx_assert+0xc2/frame 0xfffffe0095cbd650
mi_switch() at mi_switch+0x6d/frame 0xfffffe0095cbd670
sleepq_switch() at sleepq_switch+0x107/frame 0xfffffe0095cbd6b0
rtR0SemEventMultiBsdWait() at rtR0SemEventMultiBsdWait+0x293/frame 0xfffffe0095cbd710
vgdrvHgcmAsyncWaitCallbackWorker() at vgdrvHgcmAsyncWaitCallbackWorker+0x10e/frame 0xfffffe0095cbd750
VbglR0HGCMInternalConnect() at VbglR0HGCMInternalConnect+0x125/frame 0xfffffe0095cbd7a0
vgdrvIoCtl_HGCMConnect() at vgdrvIoCtl_HGCMConnect+0x42/frame 0xfffffe0095cbd7e0
VGDrvCommonProcessOptionsFromHost() at VGDrvCommonProcessOptionsFromHost+0x1f1/frame 0xfffffe0095cbd8e0
vgdrvFreeBSDAttach() at vgdrvFreeBSDAttach+0x1d8/frame 0xfffffe0095cbd920
device_attach() at device_attach+0x3c0/frame 0xfffffe0095cbd960
device_probe_and_attach() at device_probe_and_attach+0x70/frame 0xfffffe0095cbd990
pci_driver_added() at pci_driver_added+0xf2/frame 0xfffffe0095cbd9d0
devclass_driver_added() at devclass_driver_added+0x39/frame 0xfffffe0095cbda10
devclass_add_driver() at devclass_add_driver+0x157/frame 0xfffffe0095cbda50
module_register_init() at module_register_init+0xb0/frame 0xfffffe0095cbda80
linker_load_module() at linker_load_module+0xbc0/frame 0xfffffe0095cbdd80
kern_kldload() at kern_kldload+0x16e/frame 0xfffffe0095cbddd0
sys_kldload() at sys_kldload+0x5b/frame 0xfffffe0095cbde00
amd64_syscall() at amd64_syscall+0x140/frame 0xfffffe0095cbdf30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0095cbdf30
--- syscall (304, FreeBSD ELF64, kldload), rip = 0xa84a98fbc6a, rsp = 0xa84a8bd17e8, rbp = 0xa84a8bd1d60 ---
KDB: enter: panic
[ thread pid 140 tid 100161 ]
Stopped at      kdb_enter+0x32: movq    $0,0xde2ac3(%rip)
db>
Comment 1 groenveld 2023-05-19 17:45:24 UTC
(In reply to groenveld from comment #0)


$ VBoxManage showvminfo fbsd14 --machinereadable
name="fbsd14"
groups="/"
ostype="FreeBSD (64-bit)"
UUID="2670d13a-8d3b-45c7-a016-d184de44c517"
CfgFile="/home/john/VirtualBox VMs/fbsd14/fbsd14.vbox"
SnapFldr="/home/john/VirtualBox VMs/fbsd14/Snapshots"
LogFldr="/home/john/VirtualBox VMs/fbsd14/Logs"
hardwareuuid="2670d13a-8d3b-45c7-a016-d184de44c517"
memory=2048
pagefusion="off"
vram=128
cpuexecutioncap=100
hpet="off"
cpu-profile="host"
chipset="piix3"
firmware="EFI"
cpus=1
pae="off"
longmode="on"
triplefaultreset="off"
apic="on"
x2apic="off"
nested-hw-virt="off"
cpuid-portability-level=0
bootmenu="messageandmenu"
boot1="floppy"
boot2="dvd"
boot3="disk"
boot4="none"
acpi="on"
ioapic="on"
biosapic="apic"
biossystemtimeoffset=0
BIOS NVRAM File="/home/john/VirtualBox VMs/fbsd14/fbsd14.nvram"
rtcuseutc="off"
hwvirtex="on"
nestedpaging="on"
largepages="on"
vtxvpid="on"
vtxux="on"
paravirtprovider="default"
effparavirtprovider="none"
VMState="running"
VMStateChangeTime="2023-05-19T16:12:47.027000000"
graphicscontroller="vboxsvga"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
tracing-enabled="off"
tracing-allow-vm-access="off"
tracing-config=""
autostart-enabled="off"
autostart-delay=0
defaultfrontend=""
vmprocpriority="default"
storagecontrollername0="AHCI"
storagecontrollertype0="IntelAhci"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="30"
storagecontrollerportcount0="2"
storagecontrollerbootable0="on"
"AHCI-0-0"="emptydrive"
"AHCI-IsEjected"="off"
"AHCI-1-0"="/home/john/VirtualBox VMs/fbsd14/fbsd14.vdi"
"AHCI-ImageUUID-1-0"="e8ce2258-2a6e-4467-8f46-5111988fc52c"
"AHCI-nonrotational"="off"
"AHCI-discard"="off"
natnet1="nat"
macaddress1="080027936843"
cableconnected1="on"
nic1="nat"
nictype1="82540EM"
nicspeed1="0"
mtu="0"
sockSnd="64"
sockRcv="64"
tcpWndSnd="64"
tcpWndRcv="64"
nic2="none"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="0x03f8,4"
uartmode1="tcpclient,127.0.0.1:9999"
uarttype1="16550A"
uart2="off"
uart3="off"
uart4="off"
lpt1="off"
lpt2="off"
audio="oss"
audio_out="on"
audio_in="off"
clipboard="disabled"
draganddrop="disabled"
SessionName="GUI/Qt"
VideoMode="1024,768,32"@0,0 1
vrde="off"
usb="on"
ehci="off"
xhci="off"
VRDEActiveConnection="off"
VRDEClients==0
GuestMemoryBalloon=0
GuestOSType="FreeBSD_64"
GuestAdditionsRunLevel=0
GuestAdditionsFacility_VirtualBox Base Driver=0,1684514310564
GuestAdditionsFacility_Seamless Mode=0,1684514310564
GuestAdditionsFacility_Graphics Mode=0,1684514310564
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2023-05-23 00:00:21 UTC
(In reply to groenveld from comment #1)

No crash, for me, with the configuration below. 

FreeBSD mowa219-gjp4-freebsd-14-vm 14.0-CURRENT FreeBSD 14.0-CURRENT #1 main-n263024-ec6d620b197e: Mon May 22 01:36:07 BST 2023     root@mowa219-gjp4-freebsd-14-vm:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400088 1400088


% VBoxManage showvminfo "FreeBSD 14.0-CURRENT" --machinereadable
name="FreeBSD 14.0-CURRENT"
groups="/BSD/FreeBSD"
ostype="FreeBSD (64-bit)"
UUID="e4acd376-6326-40ff-b975-eda95b29e4e8"
CfgFile="/media/t1000/VirtualBox/BSD/FreeBSD/FreeBSD 14.0-CURRENT/FreeBSD 14.0-CURRENT.vbox"
SnapFldr="/media/t1000/VirtualBox/BSD/FreeBSD/FreeBSD 14.0-CURRENT/Snapshots"
LogFldr="/media/t1000/VirtualBox/BSD/FreeBSD/FreeBSD 14.0-CURRENT/Logs"
hardwareuuid="e4acd376-6326-40ff-b975-eda95b29e4e8"
memory=3184
pagefusion="off"
vram=16
cpuexecutioncap=100
hpet="off"
cpu-profile="host"
chipset="piix3"
firmware="BIOS"
cpus=4
pae="on"
longmode="on"
triplefaultreset="off"
apic="on"
x2apic="off"
nested-hw-virt="off"
cpuid-portability-level=0
bootmenu="messageandmenu"
boot1="disk"
boot2="dvd"
boot3="none"
boot4="none"
acpi="on"
ioapic="on"
biosapic="apic"
biossystemtimeoffset=0
rtcuseutc="off"
hwvirtex="on"
nestedpaging="on"
largepages="on"
vtxvpid="on"
vtxux="on"
paravirtprovider="default"
effparavirtprovider="none"
VMState="running"
VMStateChangeTime="2023-05-22T17:02:29.606000000"
graphicscontroller="vboxsvga"
monitorcount=1
accelerate3d="off"
accelerate2dvideo="off"
teleporterenabled="off"
teleporterport=0
teleporteraddress=""
teleporterpassword=""
tracing-enabled="off"
tracing-allow-vm-access="off"
tracing-config=""
autostart-enabled="off"
autostart-delay=0
defaultfrontend=""
vmprocpriority="default"
storagecontrollername0="IDE"
storagecontrollertype0="PIIX4"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="2"
storagecontrollerportcount0="2"
storagecontrollerbootable0="on"
"IDE-0-0"="/media/t1000/VirtualBox/BSD/FreeBSD/FreeBSD 14.0-CURRENT/FreeBSD 14.0-CURRENT.vdi"
"IDE-ImageUUID-0-0"="c9dd0987-450a-4b82-8c54-535d1812541a"
"IDE-nonrotational"="off"
"IDE-discard"="off"
"IDE-0-1"="none"
"IDE-1-0"="emptydrive"
"IDE-IsEjected"="off"
"IDE-1-1"="none"
natnet1="nat"
macaddress1="080027BE2E8F"
cableconnected1="on"
nic1="nat"
nictype1="82540EM"
nicspeed1="0"
mtu="0"
sockSnd="64"
sockRcv="64"
tcpWndSnd="64"
tcpWndRcv="64"
nic2="none"
nic3="none"
nic4="none"
nic5="none"
nic6="none"
nic7="none"
nic8="none"
hidpointing="ps2mouse"
hidkeyboard="ps2kbd"
uart1="off"
uart2="off"
uart3="off"
uart4="off"
lpt1="off"
lpt2="off"
audio="oss"
audio_out="on"
audio_in="off"
clipboard="bidirectional"
draganddrop="bidirectional"
SessionName="GUI/Qt"
VideoMode="720,400,0"@0,0 1
vrde="off"
usb="on"
ehci="off"
xhci="off"
VRDEActiveConnection="off"
VRDEClients==0
GuestMemoryBalloon=0
GuestOSType="FreeBSD_64"
GuestAdditionsRunLevel=2
GuestAdditionsVersion="6.1.44 r156814"
GuestAdditionsFacility_VirtualBox Base Driver=50,1684799197186
GuestAdditionsFacility_VirtualBox System Service=50,1684799212534
GuestAdditionsFacility_Seamless Mode=0,1684799497057
GuestAdditionsFacility_Graphics Mode=0,1684799497057
%
Comment 3 Alex Bylund 2023-05-23 12:45:52 UTC
With no config/install, only loading the mod, a backtrace shows an assert is causing this,

#ifdef INVARIANTS
	if (!TD_ON_LOCK(td) && !TD_IS_RUNNING(td))
		mtx_assert(&Giant, MA_NOTOWNED);
#endif

in sys/kern/kern_synch.c mi_switch()

same uname as comment 0
Comment 4 Alex Bylund 2023-05-23 17:19:50 UTC
Using cscope and looking at the functions from the stack backtrace, mutex is giant locked in module_register_init. device_probe_and_attach (subr_bus.c) seems to be having multiple problems in git log, and at some point had GIANT_REQUIRED removed, which would seem to be delaying the error.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2023-05-23 21:02:11 UTC
(In reply to Graham Perrin from comment #2)
diff:
-firmware="EFI"
-cpus=1
-pae="off"
+firmware="BIOS"
+cpus=4
+pae="on"

-BIOS NVRAM File="/home/john/VirtualBox VMs/fbsd14/fbsd14.nvram"

-storagecontrollername0="AHCI"
-storagecontrollertype0="IntelAhci"
+storagecontrollername0="IDE"
+storagecontrollertype0="PIIX4"

-uart1="0x03f8,4"
-uartmode1="tcpclient,127.0.0.1:9999"
-uarttype1="16550A"
+uart1="off"

-clipboard="disabled"
-draganddrop="disabled"
+clipboard="bidirectional"
+draganddrop="bidirectional"
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2023-05-25 02:06:40 UTC
(In reply to Vladimir Druzenko from comment #5)

Thanks … also/alternatively, might GENERIC-NODEBUG be the reason for no crash in my case?
Comment 7 Alex Bylund 2023-05-25 19:53:55 UTC
Created attachment 242409 [details]
Proposed device_probe_and_attach FIX

This does not fix the vboxguest problem, but it does remove the function from the stack backtrace. It seems pretty self-explanatory, and will/would probably break whatever is trying to rely on some magical solution.

(In reply to Graham Perrin from comment #6)
Yes, assert is a debugging function.
Comment 8 groenveld 2023-07-18 22:53:30 UTC
Created attachment 243468 [details]
emulators/virtualbox-ose-additions: make package log

Some changes to the VFS API appear to break the build.
John
groenveld@acm.org
Comment 9 groenveld 2023-09-25 20:39:52 UTC
Working with 14.0-BETA3.
John
groenveld@acm.org