Bug 219913

Summary: emulators/virtualbox-ose-kmod: if MAXCPU option is not default for running kernel 'kldload vboxdrv.ko' will result in kernel panic
Product: Ports & Packages Reporter: Andriy Voskoboinyk <avos>
Component: Individual Port(s)Assignee: vbox
Status: New ---    
Severity: Affects Only Me CC: avos, leres, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (vbox)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch leres: maintainer-approval?

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]
patch

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