Hi,
I have faced the same issue and was also only on 5.18 anymore.
I used the Suse Patch Henrik provided in his mail, stripped it from the
VBoxNetFlt-linux.c chunck, since this has already been added to the
debian package in the 020-linux518.patch file.
I have now used the attached patch file and virtual box is now running
with these changes on 2 AMD64 machines without issues again.
Hope that this patch can be included until 6.1.35 will be released into sid.
thanks
Philipp
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
virtualbox (6.1.34-dfsg-3) unstable; urgency=medium
.
* Add patch from archlinux to fix a build failure with kernel 5.18
(Closes: #1012122)
Author: Gianfranco Costamagna <locutusofb...@debian.org>
Bug-Debian: https://bugs.debian.org/1012122
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2022-06-28
--- virtualbox-6.1.34-dfsg.orig/include/VBox/sup.h
+++ virtualbox-6.1.34-dfsg/include/VBox/sup.h
@@ -2142,7 +2142,25 @@ RT_IPRT_FORMAT_ATTR(1, 2) SUPR0Printf(co
*/
SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void);
-/** @copydoc RTLogGetDefaultInstanceEx
+/**
+ * Notification from R0 VMM prior to loading the guest-FPU register state.
+ *
+ * @returns Whether the host-FPU register state has been saved by the host
kernel.
+ * @param fCtxHook Whether thread-context hooks are enabled.
+ *
+ * @remarks Called with preemption disabled.
+ */
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook);
+
+/**
+ * Notification from R0 VMM prior to saving the guest-FPU register state (and
+ * potentially restoring the host-FPU register state) in ring-0.
+ *
+ * @param fCtxHook Whether thread-context hooks are enabled.
+ *
+ * @remarks Called with preemption disabled.
+ */
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook); /** @copydoc
RTLogGetDefaultInstanceEx
* @remarks To allow overriding RTLogGetDefaultInstanceEx locally. */
SUPR0DECL(struct RTLOGGER *) SUPR0GetDefaultLogInstanceEx(uint32_t
fFlagsAndGroup);
/** @copydoc RTLogRelGetDefaultInstanceEx
--- virtualbox-6.1.34-dfsg.orig/src/VBox/Additions/linux/sharedfolders/regops.c
+++ virtualbox-6.1.34-dfsg/src/VBox/Additions/linux/sharedfolders/regops.c
@@ -3823,7 +3823,9 @@ struct address_space_operations vbsf_reg
.readpage = vbsf_readpage,
.writepage = vbsf_writepage,
/** @todo Need .writepages if we want msync performance... */
-#if RTLNX_VER_MIN(2,5,12)
+#if RTLNX_VER_MIN(5,18,0)
+ .dirty_folio = block_dirty_folio,
+#elif RTLNX_VER_MIN(2,5,12)
.set_page_dirty = __set_page_dirty_buffers,
#endif
#if RTLNX_VER_MIN(5,14,0)
--- virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/SUPDrv.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/SUPDrv.cpp
@@ -98,7 +98,18 @@
# endif
#endif
-
+#if defined(RT_OS_LINUX) && !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) &&
defined(CONFIG_FORTIFY_SOURCE)
+/* In Linux 5.18-rc1, memcpy became a wrapper which does fortify checks
+ * before triggering __underlying_memcpy() call. We do not pass these checks
here,
+ * so bypass them for now. */
+# if RTLNX_VER_MIN(5,18,0)
+# define SUPDRV_MEMCPY __underlying_memcpy
+# else
+# define SUPDRV_MEMCPY memcpy
+# endif
+#else
+# define SUPDRV_MEMCPY memcpy
+#endif
/*
* Logging assignments:
* Log - useful stuff, like failures.
@@ -267,6 +278,8 @@ static SUPFUNC g_aFunctions[] =
SUPEXP_STK_BACK( 2, SUPR0ChangeCR4),
SUPEXP_STK_BACK( 1, SUPR0EnableVTx),
SUPEXP_STK_BACK( 0, SUPR0SuspendVTxOnCpu),
+ SUPEXP_STK_OKAY( 1, SUPR0FpuBegin),
+ SUPEXP_STK_OKAY( 1, SUPR0FpuEnd),
SUPEXP_STK_BACK( 1, SUPR0ResumeVTxOnCpu),
SUPEXP_STK_OKAY( 1, SUPR0GetCurrentGdtRw),
SUPEXP_STK_OKAY( 0, SUPR0GetKernelFeatures),
@@ -1742,7 +1755,7 @@ static int supdrvIOCtlInnerUnrestricted(
/* execute */
pReq->u.Out.cFunctions = RT_ELEMENTS(g_aFunctions);
- memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions,
sizeof(g_aFunctions));
+ SUPDRV_MEMCPY(&pReq->u.Out.aFunctions[0], g_aFunctions,
sizeof(g_aFunctions));
pReq->Hdr.rc = VINF_SUCCESS;
return 0;
}
--- virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/SUPLib.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/SUPLib.cpp
@@ -505,7 +505,7 @@ static int supInitFake(PSUPDRVSESSION *p
if (g_pSupFunctions)
{
g_pSupFunctions->u.Out.cFunctions = RT_ELEMENTS(s_aFakeFunctions);
- memcpy(&g_pSupFunctions->u.Out.aFunctions[0], &s_aFakeFunctions[0],
sizeof(s_aFakeFunctions));
+ memcpy(&g_pSupFunctions->u.Out.aFunctions, &s_aFakeFunctions[0],
sizeof(s_aFakeFunctions));
g_pSession = (PSUPDRVSESSION)(void *)g_pSupFunctions;
if (ppSession)
*ppSession = g_pSession;
---
virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
@@ -2002,6 +2002,17 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+ return false;
+}
+
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+}
/*
*
* org_virtualbox_SupDrv
---
virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
@@ -640,3 +640,15 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
return 0;
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+ return false;
+}
+
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+}
+
---
virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1454,6 +1454,31 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+#if RTLNX_VER_MIN(5,18,0)
+ kernel_fpu_begin();
+ /* if (fCtxHook) */
+ preempt_enable(); /* HACK ALERT! undo the implicit preempt_disable()
in kernel_fpu_begin(). */
+ return true;
+#else
+ return false;
+#endif
+}
+
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+#if RTLNX_VER_MIN(5,18,0)
+ /* if (fCtxHook) */
+ preempt_disable(); /* HACK ALERT! undo the implicit preempt_enable()
in SUPR0FpuBegin(). */
+ kernel_fpu_end();
+#endif
+}
+
+
int VBOXCALL supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw)
{
#if RTLNX_VER_MIN(4,12,0)
--- virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
@@ -541,3 +541,15 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
return 0;
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+ return false;
+}
+
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+}
+
---
virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
@@ -1309,3 +1309,15 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
return 0;
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+ return false;
+}
+
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+}
+
--- virtualbox-6.1.34-dfsg.orig/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
@@ -2703,6 +2703,16 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur
return 0;
}
+SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+ return false;
+}
+
+SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
+{
+ RT_NOREF(fCtxHook);
+}
SUPR0DECL(int) SUPR0IoCtlSetupForHandle(PSUPDRVSESSION pSession, intptr_t
hHandle, uint32_t fFlags, PSUPR0IOCTLCTX *ppCtx)
{
--- virtualbox-6.1.34-dfsg.orig/src/VBox/VMM/VMMR0/CPUMR0.cpp
+++ virtualbox-6.1.34-dfsg/src/VBox/VMM/VMMR0/CPUMR0.cpp
@@ -440,6 +440,8 @@ VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(P
Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST));
Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_SYNC_FPU_STATE));
+ /* Notify the support driver prior to loading the guest-FPU register
state. */
+ SUPR0FpuBegin(false /* unused */);
if (!pVM->cpum.s.HostFeatures.fLeakyFxSR)
{
Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE));
@@ -485,6 +487,8 @@ VMMR0_INT_DECL(bool) CPUMR0FpuStateMaybe
if (pVCpu->cpum.s.fUseFlags & (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST))
{
fSavedGuest = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST);
+ /* Notify the support driver prior to loading the host-FPU register
state. */
+ SUPR0FpuEnd(false /* unused */);
if (!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE))
cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s);
else