Bug 287755 - emulators/virtualbox-ose-additions 6.x vboxguest kernel panic: mutex Giant owned at /usr/src/sys/kern/kern_synch.c:481
Summary: emulators/virtualbox-ose-additions 6.x vboxguest kernel panic: mutex Giant ow...
Status: New
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:
Depends on:
Blocks:
 
Reported: 2025-06-23 20:14 UTC by Graham Perrin
Modified: 2025-12-04 15:57 UTC (History)
2 users (show)

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


Attachments
Screenshot: preparing to load vboxguest (21.86 KB, image/png)
2025-06-23 20:14 UTC, Graham Perrin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin 2025-06-23 20:14:45 UTC
Created attachment 261516 [details]
Screenshot: preparing to load vboxguest

Built from source. vboxguest will not load, the kernel panics.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-06-23 20:18:30 UTC
What has changed on this host?
Comment 2 Graham Perrin 2025-06-23 20:28:17 UTC
Host
====

grahamperrin@mowa219-gjp4-zbook-freebsd ~> freebsd-version -kru ; uname -mvKU
15.0-CURRENT
15.0-CURRENT
15.0-CURRENT
FreeBSD 15.0-CURRENT main-n278117-be8e84c2e924 GENERIC-NODEBUG amd64 1500048 1500048
grahamperrin@mowa219-gjp4-zbook-freebsd ~> 

Guest
=====

Nothing changed, it's a fresh installation from a pkgbase-enabled DVD.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2025-06-23 20:36:57 UTC
> it's a fresh installation
Probably something in the base was broken again with backward compatibility.
Port work fine some time ago.
I can only suggest trying previous versions - below 1500048.
Comment 4 Graham Perrin 2025-06-23 21:27:35 UTC
Re: comment 0

Dump header from device: /dev/ada0p3
  Architecture: amd64
  Architecture Version: 2
  Dump Length: 275509248
  Blocksize: 512
  Compression: none
  Dumptime: 2025-06-23 21:10:52 +0100
  Hostname: blah
  Magic: FreeBSD Kernel Dump
  Version String: FreeBSD 15.0-CURRENT #0 main-n278150-2c186228096a-dirty: Mon Jun 23 03:12:36 BST 2025
    grahamperrin@mowa219-gjp4-zbook-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
  Panic String: mutex Giant owned at /usr/src/sys/kern/kern_synch.c:481
  Dump Parity: 3604680018
  Bounds: 2
  Dump Status: good
Comment 5 Jason W. Bacon freebsd_committer freebsd_triage 2025-07-16 20:46:42 UTC
I think I'm seeing the same error with a snapshot from yesterday.  This prevents desktop-installer from completing if the user accepts the default 'y' response to installing guest additions.

Dump header from device: /dev/ada0p3
  Architecture: amd64
  Architecture Version: 2
  Dump Length: 116293632
  Blocksize: 512
  Compression: none
  Dumptime: 2025-07-16 15:28:39 -0500
  Hostname: 
  Magic: FreeBSD Kernel Dump
  Version String: FreeBSD 15.0-CURRENT main-n278795-b2bf651a797b GENERIC
  Panic String: mutex Giant owned at /home/pkgbuild/worktrees/main/sys/kern/kern_synch.c:481
  Dump Parity: 1615742292
  Bounds: 0
  Dump Status: good
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2025-07-16 20:59:00 UTC
(In reply to Jason W. Bacon from comment #5)
#ifdef INVARIANTS
        if (!TD_ON_LOCK(td) && !TD_IS_RUNNING(td))
                mtx_assert(&Giant, MA_NOTOWNED); <=== this line is 481
#endif
Comment 7 Jason W. Bacon freebsd_committer freebsd_triage 2025-07-17 12:07:57 UTC
(In reply to Vladimir Druzenko from comment #6)

Looks like that code hasn't changed since 14.x, and yet the guest additions work fine on 14.3-RELEASE.  Any idea what might be causing that assert to fail on current?
Comment 8 Vladimir Druzenko freebsd_committer freebsd_triage 2025-07-17 12:16:10 UTC
(In reply to Jason W. Bacon from comment #7)
Even if build 14.x kernel with INVARIANTS?
Comment 9 Jason W. Bacon freebsd_committer freebsd_triage 2025-07-17 22:09:37 UTC
(In reply to Vladimir Druzenko from comment #8)

Generic kernel in both cases.  So INVARIANTS is defined by default on 15.x, but not on 14.x?
Comment 10 Jason W. Bacon freebsd_committer freebsd_triage 2025-07-17 22:18:53 UTC
(In reply to Jason W. Bacon from comment #9)

Found this explaining INVARIANTS.

https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/#kerneldebug-deadlocks

I'll try a buildkern on 14.x when I can block some time.
Comment 11 Jason W. Bacon freebsd_committer freebsd_triage 2025-07-18 17:09:38 UTC
On a 14.3-RELEASE VM, I did

make buildkernel KERNCONF=GENERIC-DEBUG
make installkernel KERNCONF=GENERIC-DEBUG

GENERIC-DEBUG enables INVARIANTS among other things.

Upon rebooting, it panicked just like the 15-CURRENT VM.  Commenting out 

vboxguest_enable="YES"

in /etc/rc.conf allowed it to boot again.

So this is not specific to 15.x.  There seems to be a more general problem that is ignored by the GENERIC kernel.
Comment 12 Vladimir Druzenko freebsd_committer freebsd_triage 2025-11-12 12:51:38 UTC
(In reply to Jason W. Bacon from comment #11)
Maybe it need CFLAGS+=-DINVARIANTS like *-kmod port:
https://cgit.freebsd.org/ports/commit/emulators/virtualbox-ose-kmod?id=f3a57fc3f648b7ea7a2f01e0539e81b5514b663e

Can you test this?
Comment 13 Jason W. Bacon freebsd_committer freebsd_triage 2025-11-12 14:44:47 UTC
Not seeing the problem on 15 beta5.  Maybe have to install a current snapshot again.
Comment 14 Jason W. Bacon freebsd_committer freebsd_triage 2025-11-30 18:22:52 UTC
Adding CFLAGS+=--DINVARIANTS to either -additions or -additions-70 results in

link_elf_obj: symbol kassert_panic undefined
linker_load_file: /boot/modules/vboxguest.ko - unsupported file type
Comment 15 Vladimir Druzenko freebsd_committer freebsd_triage 2025-12-02 20:57:37 UTC
(In reply to Jason W. Bacon from comment #13)
I think the kernel for 15.0-beta5 build without debug (without INVARIANTS).
If build DEBUG kernel on 15.0 (released today), then probably need to build emulators/virtualbox-ose-additions* with CFLAGS+=--DINVARIANTS.
Comment 16 Jason W. Bacon freebsd_committer freebsd_triage 2025-12-03 00:31:11 UTC
(In reply to Vladimir Druzenko from comment #15)

Oops, forgot to mention my attempts to use -DINVARIANTS were on 16-current.
Comment 17 Vladimir Druzenko freebsd_committer freebsd_triage 2025-12-04 15:57:18 UTC
Can you test something from this:
+---+-------------+----------------------+-----------------------+-------+
| № |   Version   | INVARIANTS in kernel | CFLAGS+=--DINVARIANTS | work? |
+---+-------------+----------------------+-----------------------+-------+
| 1 |16.0-CURRENT | yes                  | yes                   |       |
| 2 |16.0-CURRENT | no                   | yes                   |       |
| 3 |16.0-CURRENT | yes                  | no                    |       |
| 4 |16.0-CURRENT | no                   | no                    |       |
| 5 |15.0-RELEASE | yes                  | yes                   |       |
| 6 |15.0-RELEASE | no                   | yes                   |       |
| 7 |15.0-RELEASE | yes                  | no                    |       |
| 8 |15.0-RELEASE | no                   | no                    |       |
| 9 |14.3-RELEASE | yes                  | yes                   |       |
|10 |14.3-RELEASE | no                   | yes                   |       |
|11 |14.3-RELEASE | yes                  | no                    |       |
|12 |14.3-RELEASE | no                   | no                    | yes   |
+---+-------------+----------------------+-----------------------+-------+

12th I know result - tested on multiple VMs.