From 4b8e205e92518ed55cf2e8b0302f1f7f04c15e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 16 Jul 2022 20:03:42 +0700 Subject: [PATCH] virtualbox-ose: update to 6.1.34. --- .../patches/005-gsoap-build.patch | 6 +- .../patches/008-no-vboxvideo.patch | 6 +- .../virtualbox-ose/patches/013-Makefile.patch | 4 +- .../patches/016-disable-cloud.patch | 1 - .../patches/017-libvdeplug-soname.patch | 3 - .../patches/vbox-linux-5.18.patch | 254 +++++++++++++ .../patches/vbox-linux-5.19.patch | 356 ++++++++++++++++++ srcpkgs/virtualbox-ose/template | 4 +- 8 files changed, 619 insertions(+), 15 deletions(-) create mode 100644 srcpkgs/virtualbox-ose/patches/vbox-linux-5.18.patch create mode 100644 srcpkgs/virtualbox-ose/patches/vbox-linux-5.19.patch diff --git a/srcpkgs/virtualbox-ose/patches/005-gsoap-build.patch b/srcpkgs/virtualbox-ose/patches/005-gsoap-build.patch index 17022f01b920..a2855354f5e2 100644 --- a/srcpkgs/virtualbox-ose/patches/005-gsoap-build.patch +++ b/srcpkgs/virtualbox-ose/patches/005-gsoap-build.patch @@ -1,6 +1,6 @@ ---- a/src/VBox/Main/webservice/Makefile.kmk 2016-08-16 22:00:21.000000000 +0200 -+++ b/src/VBox/Main/webservice/Makefile.kmk 2016-08-18 10:05:45.548857031 +0200 -@@ -724,7 +724,7 @@ +--- a/src/VBox/Main/webservice/Makefile.kmk ++++ b/src/VBox/Main/webservice/Makefile.kmk +@@ -771,7 +771,7 @@ $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,lots of files,$(GSOAPH_RELEVANT)) $(RM) -f $@ diff --git a/srcpkgs/virtualbox-ose/patches/008-no-vboxvideo.patch b/srcpkgs/virtualbox-ose/patches/008-no-vboxvideo.patch index 967c9d47362a..6f646ac02eeb 100644 --- a/srcpkgs/virtualbox-ose/patches/008-no-vboxvideo.patch +++ b/srcpkgs/virtualbox-ose/patches/008-no-vboxvideo.patch @@ -1,6 +1,6 @@ ---- a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk 2016-10-11 02:49:23.184986182 +0100 -+++ b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk 2016-10-11 02:49:39.879176964 +0100 -@@ -376,7 +376,7 @@ vboxvideo_drv_118_SOURCES := $(vboxvideo +--- a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk ++++ b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk +@@ -397,7 +397,7 @@ vboxvideo_drv_118_LIBS += $(vboxvideo_dr ifdef VBOX_USE_SYSTEM_XORG_HEADERS # Build using local X.Org headers. We assume X.Org Server 1.7 or later. diff --git a/srcpkgs/virtualbox-ose/patches/013-Makefile.patch b/srcpkgs/virtualbox-ose/patches/013-Makefile.patch index 30b44c7259fd..d1b5a8dcf874 100644 --- a/srcpkgs/virtualbox-ose/patches/013-Makefile.patch +++ b/srcpkgs/virtualbox-ose/patches/013-Makefile.patch @@ -1,5 +1,3 @@ -diff --git a/src/VBox/HostDrivers/linux/Makefile b/src/VBox/HostDrivers/linux/Makefile -index 18466b48..7c7de4e5 100644 --- a/src/VBox/HostDrivers/linux/Makefile +++ b/src/VBox/HostDrivers/linux/Makefile @@ -23,25 +23,25 @@ @@ -36,7 +34,7 @@ index 18466b48..7c7de4e5 100644 KBUILD_VERBOSE ?= KERN_VER ?= $(shell uname -r) -@@ -146,4 +146,4 @@ load: unload +@@ -167,4 +167,4 @@ load: unload fi; \ done diff --git a/srcpkgs/virtualbox-ose/patches/016-disable-cloud.patch b/srcpkgs/virtualbox-ose/patches/016-disable-cloud.patch index 0d159d3f0f09..e92e52306d1d 100644 --- a/srcpkgs/virtualbox-ose/patches/016-disable-cloud.patch +++ b/srcpkgs/virtualbox-ose/patches/016-disable-cloud.patch @@ -9,4 +9,3 @@ ## @} - diff --git a/srcpkgs/virtualbox-ose/patches/017-libvdeplug-soname.patch b/srcpkgs/virtualbox-ose/patches/017-libvdeplug-soname.patch index 1c1bcf96dcf1..a3c1e34a057e 100644 --- a/srcpkgs/virtualbox-ose/patches/017-libvdeplug-soname.patch +++ b/srcpkgs/virtualbox-ose/patches/017-libvdeplug-soname.patch @@ -2,8 +2,6 @@ Description: Revert http://www.virtualbox.org/changeset/36310 The libvdeplug.so symlink is only shipped in the -dev package. Author: Felix Geyer -Index: virtualbox/include/VBox/VDEPlugSymDefs.h -=================================================================== --- a/include/VBox/VDEPlugSymDefs.h +++ b/include/VBox/VDEPlugSymDefs.h @@ -1,5 +1,5 @@ @@ -22,4 +20,3 @@ Index: virtualbox/include/VBox/VDEPlugSymDefs.h #define RT_RUNTIME_LOADER_LIB_NAME VBOX_LIB_VDE_PLUG_NAME /** The name of the loader function */ - diff --git a/srcpkgs/virtualbox-ose/patches/vbox-linux-5.18.patch b/srcpkgs/virtualbox-ose/patches/vbox-linux-5.18.patch new file mode 100644 index 000000000000..5b1ed1a266cd --- /dev/null +++ b/srcpkgs/virtualbox-ose/patches/vbox-linux-5.18.patch @@ -0,0 +1,254 @@ +Source: https://www.virtualbox.org/ticket/20914 +--- a/include/VBox/sup.h ++++ b/include/VBox/sup.h +@@ -2142,6 +2142,26 @@ RT_IPRT_FORMAT_ATTR(1, 2) SUPR0Printf(co + */ + SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void); + ++/** ++ * 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); +--- a/src/VBox/Additions/linux/sharedfolders/regops.c ++++ b/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 = filemap_dirty_folio, ++#elif RTLNX_VER_MIN(2,5,12) + .set_page_dirty = __set_page_dirty_buffers, + #endif + #if RTLNX_VER_MIN(5,14,0) +--- a/src/VBox/HostDrivers/Support/SUPDrv.cpp ++++ b/src/VBox/HostDrivers/Support/SUPDrv.cpp +@@ -98,6 +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: +@@ -266,6 +278,8 @@ static SUPFUNC g_aFunctions[] = + SUPEXP_STK_BACK( 2, SUPR0ContFree), + SUPEXP_STK_BACK( 2, SUPR0ChangeCR4), + SUPEXP_STK_BACK( 1, SUPR0EnableVTx), ++ SUPEXP_STK_OKAY( 1, SUPR0FpuBegin), ++ SUPEXP_STK_OKAY( 1, SUPR0FpuEnd), + SUPEXP_STK_BACK( 0, SUPR0SuspendVTxOnCpu), + SUPEXP_STK_BACK( 1, SUPR0ResumeVTxOnCpu), + SUPEXP_STK_OKAY( 1, SUPR0GetCurrentGdtRw), +@@ -1742,7 +1756,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; + } +--- a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp ++++ b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp +@@ -2002,6 +2002,18 @@ 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 +--- a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c ++++ b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c +@@ -640,3 +640,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); ++} ++ +--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c ++++ b/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) +--- a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp ++++ b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp +@@ -541,3 +541,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); ++} ++ +--- a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c ++++ b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c +@@ -1309,3 +1309,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); ++} ++ +--- a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp ++++ b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp +@@ -2704,6 +2704,19 @@ SUPR0DECL(uint32_t) SUPR0GetKernelFeatur + } + + ++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) + { + /* +--- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c ++++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +@@ -2311,7 +2311,13 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS + vboxNetFltDumpPacket(pSG, true, "host", (fDst & INTNETTRUNKDIR_WIRE) ? 0 : 1); + Log6(("vboxNetFltPortOsXmit: pBuf->cb dump:\n%.*Rhxd\n", sizeof(pBuf->cb), pBuf->cb)); + Log6(("vboxNetFltPortOsXmit: netif_rx_ni(%p)\n", pBuf)); ++#if RTLNX_VER_MIN(5,18,0) ++ local_bh_disable(); ++ err = netif_rx(pBuf); ++ local_bh_enable(); ++#else + err = netif_rx_ni(pBuf); ++#endif + if (err) + rc = RTErrConvertFromErrno(err); + } +--- a/src/VBox/VMM/VMMR0/CPUMR0.cpp ++++ b/src/VBox/VMM/VMMR0/CPUMR0.cpp +@@ -440,6 +440,9 @@ 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)); +@@ -484,6 +487,9 @@ VMMR0_INT_DECL(bool) CPUMR0FpuStateMaybe + Assert(ASMGetCR4() & X86_CR4_OSFXSR); + if (pVCpu->cpum.s.fUseFlags & (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST)) + { ++ /* Notify the support driver prior to loading the host-FPU register state. */ ++ SUPR0FpuEnd(false /* unused */); ++ + fSavedGuest = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); + if (!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE)) + cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s); diff --git a/srcpkgs/virtualbox-ose/patches/vbox-linux-5.19.patch b/srcpkgs/virtualbox-ose/patches/vbox-linux-5.19.patch new file mode 100644 index 000000000000..b406fa335808 --- /dev/null +++ b/srcpkgs/virtualbox-ose/patches/vbox-linux-5.19.patch @@ -0,0 +1,356 @@ +Source: https://www.virtualbox.org/ticket/20914 +--- a/include/VBox/sup.h ++++ b/include/VBox/sup.h +@@ -2162,6 +2162,26 @@ SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxH + */ + SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook); + ++/** ++ * 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 after 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); +--- a/src/VBox/Additions/linux/drm/vbox_fb.c ++++ b/src/VBox/Additions/linux/drm/vbox_fb.c +@@ -362,6 +362,9 @@ static int vboxfb_create(struct drm_fb_h + info->screen_size = size; + + #ifdef CONFIG_FB_DEFERRED_IO ++# if RTLNX_VER_MIN(5,19,0) ++ info->fix.smem_len = info->screen_size; ++# endif + info->fbdefio = &vbox_defio; + fb_deferred_io_init(info); + #endif +--- a/src/VBox/Additions/linux/drm/vbox_ttm.c ++++ b/src/VBox/Additions/linux/drm/vbox_ttm.c +@@ -320,8 +320,10 @@ static struct ttm_tt *vbox_ttm_tt_create + if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) { + #elif RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_RANGE(8,5, 8,99) + if (ttm_tt_init(tt, bo, page_flags)) { +-#else ++#elif RTLNX_VER_MAX(5,19,0) + if (ttm_tt_init(tt, bo, page_flags, ttm_write_combined)) { ++#else ++ if (ttm_tt_init(tt, bo, page_flags, ttm_write_combined, 0)) { + #endif + kfree(tt); + return NULL; +--- a/src/VBox/Additions/linux/sharedfolders/regops.c ++++ b/src/VBox/Additions/linux/sharedfolders/regops.c +@@ -3581,8 +3581,14 @@ struct inode_operations vbsf_reg_iops = + * Needed for mmap and reads+writes when the file is mmapped in a + * shared+writeable fashion. + */ ++#if RTLNX_VER_MIN(5,19,0) ++static int vbsf_read_folio(struct file *file, struct folio *folio) ++{ ++ struct page *page = &folio->page; ++#else + static int vbsf_readpage(struct file *file, struct page *page) + { ++#endif + struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode; + int err; + +@@ -3728,8 +3734,7 @@ static int vbsf_writepage(struct page *p + /** + * Called when writing thru the page cache (which we shouldn't be doing). + */ +-int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, +- unsigned len, unsigned flags, struct page **pagep, void **fsdata) ++static inline void vbsf_write_begin_warn(loff_t pos, unsigned len, unsigned flags) + { + /** @todo r=bird: We shouldn't ever get here, should we? Because we don't use + * the page cache for any writes AFAIK. We could just as well use +@@ -3745,8 +3750,24 @@ int vbsf_write_begin(struct file *file, + WARN_ON(1); + # endif + } ++} ++ ++# if RTLNX_VER_MIN(5,19,0) ++int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, ++ unsigned len, struct page **pagep, void **fsdata) ++{ ++ vbsf_write_begin_warn(pos, len, 0); ++ return simple_write_begin(file, mapping, pos, len, pagep, fsdata); ++} ++# else ++int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, ++ unsigned len, unsigned flags, struct page **pagep, void **fsdata) ++{ ++ vbsf_write_begin_warn(pos, len, flags); + return simple_write_begin(file, mapping, pos, len, flags, pagep, fsdata); + } ++# endif ++ + #endif /* KERNEL_VERSION >= 2.6.24 */ + + #if RTLNX_VER_MIN(5,14,0) +@@ -3820,7 +3841,11 @@ static int vbsf_direct_IO(int rw, struct + * @todo the FsPerf touch/flush (mmap) test fails on 4.4.0 (ubuntu 16.04 lts). + */ + struct address_space_operations vbsf_reg_aops = { ++#if RTLNX_VER_MIN(5,19,0) ++ .read_folio = vbsf_read_folio, ++#else + .readpage = vbsf_readpage, ++#endif + .writepage = vbsf_writepage, + /** @todo Need .writepages if we want msync performance... */ + #if RTLNX_VER_MIN(5,18,0) +@@ -3842,4 +3867,3 @@ struct address_space_operations vbsf_reg + .direct_IO = vbsf_direct_IO, + #endif + }; +- +--- a/src/VBox/HostDrivers/Support/SUPDrv.cpp ++++ b/src/VBox/HostDrivers/Support/SUPDrv.cpp +@@ -125,6 +125,18 @@ + * instantiation in log-vbox.c(pp). + */ + ++#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 + + /********************************************************************************************************************************* + * Defined Constants And Macros * +--- a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp ++++ b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp +@@ -2109,6 +2109,18 @@ bool org_virtualbox_SupDrv::terminate(IO + } + + ++SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++ return false; ++} ++ ++ ++SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++} ++ + /* + * + * org_virtualbox_SupDrvClient +--- a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c ++++ b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c +@@ -653,3 +653,16 @@ SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHoo + RT_NOREF(fCtxHook); + } + ++ ++SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++ return false; ++} ++ ++ ++SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++} ++ +--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c ++++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1477,6 +1478,61 @@ SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHoo + kernel_fpu_end(); + #endif + } ++ ++ ++SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++#if RTLNX_VER_MIN(4,19,0) /* Going back to 4.19.0 for better coverage, we ++ probably only need 5.17.7+ in the end. */ ++ /* ++ * HACK ALERT! ++ * ++ * We'd like to use the old __kernel_fpu_begin() API which was removed in ++ * early 2019, because we typically run with preemption enabled and have an ++ * preemption hook installed which will call kernel_fpu_end() in case we're ++ * scheduled out after getting in here. The preemption hook is almost ++ * useless if we run with preemption disabled. ++ * ++ * For the case where the kernel does not have preemption hooks, we get here ++ * with preemption already disabled and one more count doesn't make any ++ * difference. ++ * ++ * So, after the kernel_fpu_begin() call we undo the implicit preempt_disable() ++ * call it does, so the preemption hook can do its work and the VBox user has ++ * a more responsive system. ++ * ++ * See @bugref{10209#c12} and onwards for more details. ++ */ ++ Assert(fCtxHook || !RTThreadPreemptIsEnabled(NIL_RTTHREAD)); ++ kernel_fpu_begin(); ++# if 0 /* Always do it for now for better test coverage. */ ++ if (fCtxHook) ++# endif ++ preempt_enable(); ++ return false; /** @todo Not sure if we have license to use any extended state, or ++ * if we're limited to the SSE & x87 FPU. If it's the former, ++ * we should return @a true and the caller can skip ++ * saving+restoring the host state and save some time. */ ++#else ++ return false; ++#endif ++} ++ ++ ++SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++#if RTLNX_VER_MIN(4,19,0) ++ /* HACK ALERT! See SUPR0FpuBegin for an explanation of this. */ ++ Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); ++# if 0 /* Always do it for now for better test coverage. */ ++ if (fCtxHook) ++# endif ++ preempt_disable(); ++ kernel_fpu_end(); ++#endif ++} + + + int VBOXCALL supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw) +--- a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp ++++ b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp +@@ -554,3 +554,16 @@ SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHoo + RT_NOREF(fCtxHook); + } + ++ ++SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++ return false; ++} ++ ++ ++SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++} ++ +--- a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c ++++ b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c +@@ -1322,3 +1322,16 @@ SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHoo + RT_NOREF(fCtxHook); + } + ++ ++SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++ return false; ++} ++ ++ ++SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) ++{ ++ RT_NOREF(fCtxHook); ++} ++ +--- a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp ++++ b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp +@@ -2717,6 +2717,19 @@ SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHoo + } + + ++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) + { + /* +--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h ++++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +@@ -184,6 +184,11 @@ + # include + #endif + ++/* for kernel_fpu_begin / kernel_fpu_end() */ ++#if RTLNX_VER_MIN(4,2,0) ++# include ++#endif ++ + #if RTLNX_VER_MIN(3,7,0) + # include + #else +--- a/src/VBox/VMM/VMMR0/CPUMR0.cpp ++++ b/src/VBox/VMM/VMMR0/CPUMR0.cpp +@@ -443,6 +443,11 @@ VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(P + /* Notify the support driver prior to loading the guest-FPU register state. */ + SUPR0FpuBegin(false /* unused */); + ++ /* Notify the support driver prior to loading the guest-FPU register state. */ ++ SUPR0FpuBegin(VMMR0ThreadCtxHookIsEnabled(pVCpu)); ++ /** @todo use return value? Currently skipping that to be on the safe side ++ * wrt. extended state (linux). */ ++ + if (!pVM->cpum.s.HostFeatures.fLeakyFxSR) + { + Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE)); +@@ -510,6 +515,9 @@ VMMR0_INT_DECL(bool) CPUMR0FpuStateMaybe + cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s); + pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_MANUAL_XMM_RESTORE; + } ++ ++ /* Notify the support driver after loading the host-FPU register state. */ ++ SUPR0FpuEnd(VMMR0ThreadCtxHookIsEnabled(pVCpu)); + } + else + fSavedGuest = false; diff --git a/srcpkgs/virtualbox-ose/template b/srcpkgs/virtualbox-ose/template index d9f2f9825d2d..4f9976409ade 100644 --- a/srcpkgs/virtualbox-ose/template +++ b/srcpkgs/virtualbox-ose/template @@ -1,6 +1,6 @@ # Template file for 'virtualbox-ose' pkgname=virtualbox-ose -version=6.1.32 +version=6.1.34 revision=1 wrksrc="VirtualBox-${version}" short_desc="General-purpose full virtualizer for x86 hardware" @@ -9,7 +9,7 @@ license="GPL-2.0-only, CDDL-1.0" homepage="https://www.virtualbox.org" changelog="https://www.virtualbox.org/wiki/Changelog" distfiles="http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2" -checksum=5d11384200b4e943ad0056d2cf75980ae4bee852c89650e2914e1b34eedc2d2c +checksum=9c3ce1829432e5b8374f950698587038f45fb0492147dc200e59edb9bb75eb49 nopie=yes lib32disabled=yes