Bug 219913 - emulators/virtualbox-ose-kmod: if MAXCPU option is not default for running kernel 'kldload vboxdrv.ko' will result in kernel panic
Summary: emulators/virtualbox-ose-kmod: if MAXCPU option is not default for running ke...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Virtualbox Team (Nobody)
Depends on:
Reported: 2017-06-10 19:01 UTC by Andriy Voskoboinyk
Modified: 2018-04-11 03:35 UTC (History)
3 users (show)

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

patch (2.37 KB, patch)
2018-04-11 03:35 UTC, Craig Leres
leres: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andriy Voskoboinyk freebsd_committer 2017-06-10 19:01:31 UTC
Due to ABI difference (vboxdrv passes cpuset_t parameter (bitfield with CPU_SETSIZE -> MAXCPU bits) into smp_rendezvous_cpus()) kernel panics with "ncpus is 0 with non-zero map" message.

Manual "opt_global.h" inclusion from current kernel build into src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c seems to fix this issue when MAXCPU is overridden; kern.smp.maxcpus may be used instead (in case if other 'global' options are not so problematic).
Comment 1 Walter Schwarzenfeld freebsd_triage 2018-02-12 14:59:01 UTC
Feedback please!
Comment 2 Craig Leres freebsd_committer 2018-04-06 02:55:10 UTC
I just started running 11.1-RELEASE on some of my systems and ran into this. At a minimum I think the driver should refuse to load if mp_maxcpus != MAXCPU.

Is there a way to make a cpuset_t at runtime?
Comment 3 Craig Leres freebsd_committer 2018-04-11 03:35:18 UTC
Created attachment 192427 [details]

The attached patch adds a check and refuses to load vboxdrv when MAXCPU does not match mp_maxcpus.