Env: 15.0-CURRENT FreeBSD 15.0-CURRENT #1 drm-related-linuxkpi-changes-n276426-95656f357432 Commit: https://github.com/freebsd/freebsd-src/commit/93b4a54456589e78dcd37f2db8333baff3f3f0b2 Changed the meaning of NG_ABI_VERSION if the INVARIANTS kernel option was enabled for netgraph and the ng_ether kernel module. Hence what previously was: >NG_ABI_VERSION = ( 12 + 0x10000 ) Now is: >NG_ABI_VERSION = ( 0x10000 + 0x20000 + 12 ) The virtualbox-ose-*kmod ports don't correctly set invariants if the kernel is compiled with it and hence the vboxnetflt.ko module fails to load with: >KLD vboxnetflt.ko: depends on netgraph - not available or version mismatch >linker_load_file: /boot/modules/vboxnetflt.ko - unsupported file type The dirty hack I used was to make sure invariants is defined in: >work/VirtualBox-*/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c Before the netgraph.h file is included. Ie: >#define INVARIANTS 1 >#include <netgraph/netgraph.h> This allows the module to load and virtualbox runs as expected. A correct fix checking if invariants are defined in the running kernel probably should be used instead.
Patch are welcome. I don't have 15 and can't test.
The fix for this is in duplicate report 286206.
(In reply to rkoberman from comment #2) Do you confirm that patch from bug #286206 fixes this bug too?
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=271cb6e7661d964a811a67d0ec2dff9b662b62a5 commit 271cb6e7661d964a811a67d0ec2dff9b662b62a5 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-04-24 01:01:16 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-04-24 01:07:25 +0000 emulators/virtualbox-ose-kmod{,-70,-legacy}: Fix the build after FreeBSD kernel changes in 1500038 Update to chase removal of vm_page_next() PR: 286206 286193 286204 Tested by: Graham Perrin <grahamperrin@gmail.com> MFH: 2025Q2 ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 81 ++++++++++++++-------- ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 9 +-- ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 81 ++++++++++++++-------- ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 5 +- ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 69 ++++++++++++------ ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 7 +- 6 files changed, 162 insertions(+), 90 deletions(-)
A commit in branch 2025Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=32d27b2f2eff4bf158f0e742ce0b24a1d6972b77 commit 32d27b2f2eff4bf158f0e742ce0b24a1d6972b77 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-04-24 01:01:16 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-04-24 01:17:22 +0000 emulators/virtualbox-ose-kmod{,-70,-legacy}: Fix the build after FreeBSD kernel changes in 1500038 Update to chase removal of vm_page_next() PR: 286206 286193 286204 Tested by: Graham Perrin <grahamperrin@gmail.com> MFH: 2025Q2 (cherry picked from commit 271cb6e7661d964a811a67d0ec2dff9b662b62a5) ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 81 ++++++++++++++-------- ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 9 +-- ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 81 ++++++++++++++-------- ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 5 +- ...ox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c | 69 ++++++++++++------ ...VBox_Runtime_r0drv_freebsd_the-freebsd-kernel.h | 7 +- 6 files changed, 162 insertions(+), 90 deletions(-)
Thanks.
Reopening this bug. With a kernel of: 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n277266-d4147ad1a2b9: Thu May 15 23:51:09 ACST 2025 A build fresh build of the port: > /usr/ports/emulators/virtualbox-ose-kmod With the ports tree at: >commit fb9e0fe7679afcde45ada154086cd3558c6ba3e3 (HEAD -> main, origin/main) >Date: Thu May 15 09:16:15 2025 -0400 Which is post the patches applied to this bug in: fb9e0fe7679afcde45ada154086cd3558c6ba3e3 Succeeds but fails to load, instead giving: KLD vboxnetflt.ko: depends on netgraph - not available or version mismatch Defining: >#define INVARIANTS 1 Before: >#include <netgraph/netgraph.h> In >work/VirtualBox-*/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c Then allows the module to load: >42 2 0xffffffff8395b000 4248 vboxnetflt.ko The issue isn't a compilation issue but a use issue. By default Current has INVARIANTS defined, this changes the version of NG_ABI_VERSION to make sure modules without invariants can't be loaded. The port isn't defining INVARIANTS when compiling hence there is a mismatch between the NG_ABI_VERSION the module is compiled with and what the running kernel is using. The correct patch would instead of doing the #define would pull in the relevant kernel header indicating if invariants is set (any one got ideas what that is?).
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=f3a57fc3f648b7ea7a2f01e0539e81b5514b663e commit f3a57fc3f648b7ea7a2f01e0539e81b5514b663e Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2025-05-22 22:06:49 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-05-22 22:22:34 +0000 emulators/virtualbox-ose-kmod{,-70,-71,-legacy}: Fix on 15-CURRENT: linker_load_file: /boot/modules/vboxnetflt.ko - unsupported file type After commit https://github.com/freebsd/freebsd-src/commit/93b4a54456589e78dcd37f2db8333baff3f3f0b2 kernel: linker_load_file: /boot/modules/vboxnetflt.ko - unsupported file type kernel: KLD vboxnetflt.ko: depends on netgraph - not available or version mismatch Thanks to Benjamin Close <Benjamin.Close@clearchain.com> and rkoberman@gmail.com for researching the issue and identifying its cause. PR: 286204 286717 MFH: 2025Q2 emulators/virtualbox-ose-kmod-70/Makefile | 4 +++- emulators/virtualbox-ose-kmod-71/Makefile | 4 +++- emulators/virtualbox-ose-kmod-legacy/Makefile | 4 +++- emulators/virtualbox-ose-kmod/Makefile | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-)
A commit in branch 2025Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8cb6fd5cc205b6c6104a5f880a36917a1036dd8c commit 8cb6fd5cc205b6c6104a5f880a36917a1036dd8c Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2025-05-22 22:06:49 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-05-22 22:36:35 +0000 emulators/virtualbox-ose-kmod{,-70,-legacy}: Fix on 15-CURRENT: linker_load_file: /boot/modules/vboxnetflt.ko - unsupported file type After commit https://github.com/freebsd/freebsd-src/commit/93b4a54456589e78dcd37f2db8333baff3f3f0b2 kernel: linker_load_file: /boot/modules/vboxnetflt.ko - unsupported file type kernel: KLD vboxnetflt.ko: depends on netgraph - not available or version mismatch Thanks to Benjamin Close <Benjamin.Close@clearchain.com> and rkoberman@gmail.com for researching the issue and identifying its cause. PR: 286204 286717 MFH: 2025Q2 (cherry picked from commit f3a57fc3f648b7ea7a2f01e0539e81b5514b663e) emulators/virtualbox-ose-kmod-70/Makefile | 4 +++- emulators/virtualbox-ose-kmod-legacy/Makefile | 4 +++- emulators/virtualbox-ose-kmod/Makefile | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
Thanks for the fix, tested and confirmed works well!