VirtualBox

Ticket #20914: vbox-linux-5.18.patch

File vbox-linux-5.18.patch, 9.0 KB (added by galitsyn, 2 years ago)

VirtualBox-6.1.34 patch for Linux kernel 5.18 support (should be applied on top of https://download.virtualbox.org/virtualbox/6.1.34/VirtualBox-6.1.34.tar.bz2)

  • include/VBox/sup.h

     
    21422142 */
    21432143SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void);
    21442144
     2145/**
     2146 * Notification from R0 VMM prior to loading the guest-FPU register state.
     2147 *
     2148 * @returns Whether the host-FPU register state has been saved by the host kernel.
     2149 * @param   fCtxHook    Whether thread-context hooks are enabled.
     2150 *
     2151 * @remarks Called with preemption disabled.
     2152 */
     2153SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook);
     2154
     2155/**
     2156 * Notification from R0 VMM prior to saving the guest-FPU register state (and
     2157 * potentially restoring the host-FPU register state) in ring-0.
     2158 *
     2159 * @param   fCtxHook    Whether thread-context hooks are enabled.
     2160 *
     2161 * @remarks Called with preemption disabled.
     2162 */
     2163SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook);
     2164
    21452165/** @copydoc RTLogGetDefaultInstanceEx
    21462166 * @remarks To allow overriding RTLogGetDefaultInstanceEx locally. */
    21472167SUPR0DECL(struct RTLOGGER *) SUPR0GetDefaultLogInstanceEx(uint32_t fFlagsAndGroup);
  • src/VBox/Additions/linux/sharedfolders/regops.c

     
    38233823    .readpage       = vbsf_readpage,
    38243824    .writepage      = vbsf_writepage,
    38253825    /** @todo Need .writepages if we want msync performance...  */
    3826 #if RTLNX_VER_MIN(2,5,12)
     3826#if RTLNX_VER_MIN(5,18,0)
     3827    .dirty_folio = filemap_dirty_folio,
     3828#elif RTLNX_VER_MIN(2,5,12)
    38273829    .set_page_dirty = __set_page_dirty_buffers,
    38283830#endif
    38293831#if RTLNX_VER_MIN(5,14,0)
  • src/VBox/Additions

  • src/VBox/HostDrivers/Support/SUPDrv.cpp

    Property changes on: src/VBox/Additions
    ___________________________________________________________________
    Modified: svn:mergeinfo
    ## -0,0 +0,1 ##
       Merged /trunk/src/VBox/Additions:r150844
     
    9898# endif
    9999#endif
    100100
     101#if defined(RT_OS_LINUX) && !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE)
     102/* In Linux 5.18-rc1, memcpy became a wrapper which does fortify checks
     103 * before triggering __underlying_memcpy() call. We do not pass these checks here,
     104 * so bypass them for now.  */
     105# if RTLNX_VER_MIN(5,18,0)
     106#  define SUPDRV_MEMCPY __underlying_memcpy
     107# else
     108# define SUPDRV_MEMCPY  memcpy
     109# endif
     110#else
     111# define SUPDRV_MEMCPY  memcpy
     112#endif
    101113
    102114/*
    103115 * Logging assignments:
     
    266278    SUPEXP_STK_BACK(    2,  SUPR0ContFree),
    267279    SUPEXP_STK_BACK(    2,  SUPR0ChangeCR4),
    268280    SUPEXP_STK_BACK(    1,  SUPR0EnableVTx),
     281    SUPEXP_STK_OKAY(    1,  SUPR0FpuBegin),
     282    SUPEXP_STK_OKAY(    1,  SUPR0FpuEnd),
    269283    SUPEXP_STK_BACK(    0,  SUPR0SuspendVTxOnCpu),
    270284    SUPEXP_STK_BACK(    1,  SUPR0ResumeVTxOnCpu),
    271285    SUPEXP_STK_OKAY(    1,  SUPR0GetCurrentGdtRw),
     
    17421756
    17431757            /* execute */
    17441758            pReq->u.Out.cFunctions = RT_ELEMENTS(g_aFunctions);
    1745             memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions));
     1759            SUPDRV_MEMCPY(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions));
    17461760            pReq->Hdr.rc = VINF_SUCCESS;
    17471761            return 0;
    17481762        }
  • src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

     
    20022002}
    20032003
    20042004
     2005SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     2006{
     2007    RT_NOREF(fCtxHook);
     2008    return false;
     2009}
     2010
     2011
     2012SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     2013{
     2014    RT_NOREF(fCtxHook);
     2015}
     2016
    20052017/*
    20062018 *
    20072019 * org_virtualbox_SupDrv
  • src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c

     
    640640    return 0;
    641641}
    642642
     643
     644SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     645{
     646    RT_NOREF(fCtxHook);
     647    return false;
     648}
     649
     650
     651SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     652{
     653    RT_NOREF(fCtxHook);
     654}
     655
  • src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

     
    14541454}
    14551455
    14561456
     1457SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     1458{
     1459    RT_NOREF(fCtxHook);
     1460#if RTLNX_VER_MIN(5,18,0)
     1461    kernel_fpu_begin();
     1462    /* if (fCtxHook) */
     1463        preempt_enable();  /* HACK ALERT! undo the implicit preempt_disable() in kernel_fpu_begin(). */
     1464    return true;
     1465#else
     1466    return false;
     1467#endif
     1468}
     1469
     1470
     1471SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     1472{
     1473    RT_NOREF(fCtxHook);
     1474#if RTLNX_VER_MIN(5,18,0)
     1475    /* if (fCtxHook) */
     1476        preempt_disable();  /* HACK ALERT! undo the implicit preempt_enable() in SUPR0FpuBegin(). */
     1477    kernel_fpu_end();
     1478#endif
     1479}
     1480
     1481
    14571482int VBOXCALL    supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw)
    14581483{
    14591484#if RTLNX_VER_MIN(4,12,0)
  • src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp

     
    541541    return 0;
    542542}
    543543
     544
     545SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     546{
     547    RT_NOREF(fCtxHook);
     548    return false;
     549}
     550
     551
     552SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     553{
     554    RT_NOREF(fCtxHook);
     555}
     556
  • src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c

     
    13091309    return 0;
    13101310}
    13111311
     1312
     1313SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     1314{
     1315    RT_NOREF(fCtxHook);
     1316    return false;
     1317}
     1318
     1319
     1320SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     1321{
     1322    RT_NOREF(fCtxHook);
     1323}
     1324
  • src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

     
    27042704}
    27052705
    27062706
     2707SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook)
     2708{
     2709    RT_NOREF(fCtxHook);
     2710    return false;
     2711}
     2712
     2713
     2714SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook)
     2715{
     2716    RT_NOREF(fCtxHook);
     2717}
     2718
     2719
    27072720SUPR0DECL(int) SUPR0IoCtlSetupForHandle(PSUPDRVSESSION pSession, intptr_t hHandle, uint32_t fFlags, PSUPR0IOCTLCTX *ppCtx)
    27082721{
    27092722    /*
  • src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

     
    23112311                vboxNetFltDumpPacket(pSG, true, "host", (fDst & INTNETTRUNKDIR_WIRE) ? 0 : 1);
    23122312                Log6(("vboxNetFltPortOsXmit: pBuf->cb dump:\n%.*Rhxd\n", sizeof(pBuf->cb), pBuf->cb));
    23132313                Log6(("vboxNetFltPortOsXmit: netif_rx_ni(%p)\n", pBuf));
     2314#if RTLNX_VER_MIN(5,18,0)
     2315                local_bh_disable();
     2316                err = netif_rx(pBuf);
     2317                local_bh_enable();
     2318#else
    23142319                err = netif_rx_ni(pBuf);
     2320#endif
    23152321                if (err)
    23162322                    rc = RTErrConvertFromErrno(err);
    23172323            }
  • src/VBox/VMM/VMMR0/CPUMR0.cpp

     
    440440    Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST));
    441441    Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_SYNC_FPU_STATE));
    442442
     443    /* Notify the support driver prior to loading the guest-FPU register state. */
     444    SUPR0FpuBegin(false /* unused */);
     445
    443446    if (!pVM->cpum.s.HostFeatures.fLeakyFxSR)
    444447    {
    445448        Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE));
     
    484487    Assert(ASMGetCR4() & X86_CR4_OSFXSR);
    485488    if (pVCpu->cpum.s.fUseFlags & (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST))
    486489    {
     490        /* Notify the support driver prior to loading the host-FPU register state. */
     491        SUPR0FpuEnd(false /* unused */);
     492
    487493        fSavedGuest = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST);
    488494        if (!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE))
    489495            cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s);

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy