Skip to content

[Bug]: vboxdrv build failure with CONFIG_X86_FRED=y and CONFIG_KVM_INTEL=n on Linux 7.1 #835

Description

@matahina

Version

7.2.16

Host OS Type

Linux

Host OS name + version

EndeavourOS

Host Architecture

x86

Guest OS Type

all

Guest Architecture

x86

Guest OS name + version

No response

Component

Unspecified

What happened?

(Thanks vibe coding to help me writing this report as I was just compiling last kernel 7.1**.10** and then dmks failed !)

VirtualBox 7.2.16 OSE host modules fail to build against Linux 7.1 when
CONFIG_X86_FRED=y but CONFIG_KVM_INTEL is disabled.

This is reproducible on an AMD system with the following relevant kernel
configuration:

CONFIG_X86_64=y
CONFIG_X86_FRED=y
CONFIG_KVM_X86=y
CONFIG_KVM=y

CONFIG_KVM_INTEL is not set

CONFIG_KVM_AMD=m

Kernel tested:

Linux 7.1.10

VirtualBox:

virtualbox-host-dkms 7.2.16_OSE

Build error

vboxdrv/linux/SUPDrv-linux.c:266:19: error:
‘x86_entry_from_kvm’ undeclared here (not in a function);
did you mean ‘idt_entry_from_kvm’?

  266 | static __typeof__(x86_entry_from_kvm) *g_pfnX86EntryFromKvm = NULL;

Cause

SUPDrv-linux.c conditionally includes <asm/entry-common.h> for Linux >= 7.1
only when CONFIG_KVM_INTEL is enabled:

#if defined(CONFIG_X86_FRED)
# if RTLNX_VER_MIN(7,1,0) && IS_ENABLED(CONFIG_KVM_INTEL)
#  include <asm/entry-common.h>
# else
#  include <asm/fred.h>
# endif
#endif

However, the declaration of g_pfnX86EntryFromKvm is guarded only by
CONFIG_X86_FRED:

#if defined(CONFIG_X86_FRED)
# if RTLNX_VER_MIN(7,1,0)
static __typeof__(x86_entry_from_kvm) *g_pfnX86EntryFromKvm = NULL;
#  define MY_FRED_ENTRY_FROM_KVM "x86_entry_from_kvm"
...

Therefore, with CONFIG_X86_FRED=y and CONFIG_KVM_INTEL=n,
x86_entry_from_kvm is referenced without its declaration being available.

The actual uses of g_pfnX86EntryFromKvm elsewhere in SUPDrv-linux.c are
already guarded by IS_ENABLED(CONFIG_KVM_INTEL).

Tested fix

--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@
-#if defined(CONFIG_X86_FRED)
+#if defined(CONFIG_X86_FRED) && IS_ENABLED(CONFIG_KVM_INTEL)
 /** Flag whether the system is running with FRED enabled. */
 static bool g_fFredActive = false;

Result

With this change, vboxhost 7.2.16_OSE successfully builds and installs
against Linux 7.1.10 on the same AMD system.

DKMS successfully builds:

  • vboxdrv.ko
  • vboxnetflt.ko
  • vboxnetadp.ko

The fix was tested with:

dkms install --force vboxhost/7.2.16_OSE -k 7.1.10-arch1-1

and the build completed successfully.

Vide coding said

It looks like the CONFIG_KVM_INTEL guard was simply missed around the FRED
declarations when the Linux >= 7.1 x86_entry_from_kvm support was added.

How can we reproduce this?

dkms virtualbox host on EndeavourOS with latest kernel 7.1.10

For comparison, the same VirtualBox 7.2.16 host modules build successfully
against Arch Linux 7.1.10-rt1-arch1-1-rt.

Relevant configuration of the working RT kernel:

CONFIG_X86_FRED=y
CONFIG_KVM_INTEL=m

Relevant configuration of the failing custom kernel:

CONFIG_X86_FRED=y
# CONFIG_KVM_INTEL is not set

Both kernels are based on Linux 7.1.10.

This strongly suggests that the build failure is specifically triggered by
CONFIG_X86_FRED=y together with CONFIG_KVM_INTEL disabled, rather than by
Linux 7.1.10 itself.

Did you upload all of your necessary log files, screenshots, etc.?

  • Yes, I've uploaded all pertinent files to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions