Skip to content

Commit

Permalink
virtualbox: Temporary fix for kernel >= 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wkral committed Sep 23, 2019
1 parent f2eb615 commit 2f2da82
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkgs/applications/virtualization/virtualbox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ in stdenv.mkDerivation {
})
++ [
./qtx11extras.patch
# Kernel 5.3 fix, should be fixed with VirtualBox 6.0.14
# https://www.virtualbox.org/ticket/18911
./kernel-5.3-fix.patch
];

postPatch = ''
Expand Down
72 changes: 72 additions & 0 deletions pkgs/applications/virtualization/virtualbox/kernel-5.3-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
--- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
@@ -2123,7 +2123,9 @@
#endif
if (in_dev != NULL)
{
- for_ifa(in_dev) {
+ struct in_ifaddr *ifa;
+
+ for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
if (VBOX_IPV4_IS_LOOPBACK(ifa->ifa_address))
return NOTIFY_OK;

@@ -2137,7 +2139,7 @@

pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
/* :fAdded */ true, kIntNetAddrType_IPv4, &ifa->ifa_address);
- } endfor_ifa(in_dev);
+ }
}

/*
--- a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
+++ a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
@@ -283,12 +283,15 @@
if (RTCpuSetCount(&OnlineSet) > 1)
{
/* Fire the function on all other CPUs without waiting for completion. */
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
+ smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
+# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
+ Assert(!rc); NOREF(rc);
# else
int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* retry */, 0 /* wait */);
-# endif
Assert(!rc); NOREF(rc);
+# endif
}
#endif

@@ -326,7 +329,6 @@
{
#ifdef CONFIG_SMP
IPRT_LINUX_SAVE_EFL_AC();
- int rc;
RTMPARGS Args;

RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
@@ -337,14 +339,17 @@
Args.cHits = 0;

RTThreadPreemptDisable(&PreemptState);
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
+ smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+ int rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+ Assert(rc == 0); NOREF(rc);
# else /* older kernels */
- rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
+ int rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
+ Assert(rc == 0); NOREF(rc);
# endif /* older kernels */
RTThreadPreemptRestore(&PreemptState);

- Assert(rc == 0); NOREF(rc);
IPRT_LINUX_RESTORE_EFL_AC();
#else
RT_NOREF(pfnWorker, pvUser1, pvUser2);

0 comments on commit 2f2da82

Please sign in to comment.