1
0
forked from pool/virtualbox
virtualbox/fix_7.0.6_locking_problems.patch
Larry Finger 6b7b0965af Accepting request 1073624 from home:lwfinger:branches:Virtualization
- File "fixes_for_kernel_6.3.patch" is updated for more API changes
  File "fix_7.0.6_locking_problems.patch" is added. Fixes boo#1209529.
    Larry Len Rainey and I have worked on this bug for some time. It only
    happened on systems with large numbers of processors and many virtual
    machines. We suspected a locking problem, but the thought of auditing
    the entire code was daunting until it was discovered that there was no
    problem if the host ran VB 6.1.40. It did not matter what version the
    guests were running. That essentially eliminated every code part except
    for vboxdrv.ko. That made the audit tractable. There were two files and
    a total of 8 places where the locking was suspect. When those were
    changed, the lockups while using 7.0.6 host code were no longer observed.
    The lockups were infrequent, thus it is impossible to say that we have
    fixed everything, but the frequency is clearly diminished.

  spec-cleaner used to remove extra blank line is spec file.

OBS-URL: https://build.opensuse.org/request/show/1073624
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=685
2023-03-21 19:09:44 +00:00

97 lines
3.7 KiB
Diff

Index: VirtualBox-7.0.6/src/VBox/HostDrivers/Support/SUPDrv.cpp
===================================================================
--- VirtualBox-7.0.6.orig/src/VBox/HostDrivers/Support/SUPDrv.cpp
+++ VirtualBox-7.0.6/src/VBox/HostDrivers/Support/SUPDrv.cpp
@@ -871,8 +871,8 @@ void VBOXCALL supdrvDeleteDevExt(PSUPDRV
/* kill the GIP. */
supdrvGipDestroy(pDevExt);
- RTSpinlockDestroy(pDevExt->hGipSpinlock);
pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
+ RTSpinlockDestroy(pDevExt->hGipSpinlock);
supdrvTracerTerm(pDevExt);
@@ -5351,8 +5351,8 @@ static int supdrvIOCtl_LdrOpen(PSUPDRVDE
rc = supdrvLdrAddUsage(pDevExt, pSession, pImage, true /*fRing3Usage*/);
if (RT_FAILURE(rc))
{
- supdrvLdrUnlock(pDevExt);
pImage->uMagic = SUPDRVLDRIMAGE_MAGIC_DEAD;
+ supdrvLdrUnlock(pDevExt);
RTMemFree(pImage);
Log(("supdrvIOCtl_LdrOpen(%s): failed - %Rrc\n", pReq->u.In.szName, rc));
return rc;
@@ -6095,6 +6095,7 @@ static int supdrvIOCtl_LdrFree(PSUPDRVDE
/* free it */
pUsage->pImage = NULL;
pUsage->pNext = NULL;
+ RTSpinlockRelease(pDevExt->Spinlock);
RTMemFree(pUsage);
/*
@@ -6106,7 +6107,10 @@ static int supdrvIOCtl_LdrFree(PSUPDRVDE
supdrvLdrSubtractUsage(pDevExt, pImage, 1);
}
else
+ {
+ RTSpinlockRelease(pDevExt->Spinlock);
Log(("supdrvIOCtl_LdrFree: Dangling objects in %p/%s!\n", pImage->pvImage, pImage->szName));
+ }
}
else
{
@@ -6334,9 +6338,9 @@ static int supdrvIOCtl_LdrQuerySymbol(PS
rc = VERR_INVALID_HANDLE;
}
+ pReq->u.Out.pvSymbol = pvSymbol;
supdrvLdrUnlock(pDevExt);
- pReq->u.Out.pvSymbol = pvSymbol;
return rc;
}
Index: VirtualBox-7.0.6/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
===================================================================
--- VirtualBox-7.0.6.orig/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
+++ VirtualBox-7.0.6/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
@@ -4537,9 +4537,9 @@ static int supdrvTscDeltaThreadWait(PSUP
*/
static void supdrvTscDeltaThreadStartMeasurement(PSUPDRVDEVEXT pDevExt, bool fForceAll)
{
+ RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
if (pDevExt->hTscDeltaThread != NIL_RTTHREAD)
{
- RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
if ( pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Listening
|| pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
{
@@ -4550,9 +4550,9 @@ static void supdrvTscDeltaThreadStartMea
else if ( pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_WaitAndMeasure
&& fForceAll)
pDevExt->fTscThreadRecomputeAllDeltas = true;
- RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
RTThreadUserSignal(pDevExt->hTscDeltaThread);
}
+ RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
}
@@ -4628,13 +4628,13 @@ static int supdrvTscDeltaThreadInit(PSUP
}
else
OSDBGPRINT(("supdrvTscDeltaInit: RTThreadCreate failed. rc=%Rrc\n", rc));
- RTSemEventDestroy(pDevExt->hTscDeltaEvent);
pDevExt->hTscDeltaEvent = NIL_RTSEMEVENT;
+ RTSemEventDestroy(pDevExt->hTscDeltaEvent);
}
else
OSDBGPRINT(("supdrvTscDeltaInit: RTSemEventCreate failed. rc=%Rrc\n", rc));
- RTSpinlockDestroy(pDevExt->hTscDeltaSpinlock);
pDevExt->hTscDeltaSpinlock = NIL_RTSPINLOCK;
+ RTSpinlockDestroy(pDevExt->hTscDeltaSpinlock);
}
else
OSDBGPRINT(("supdrvTscDeltaInit: RTSpinlockCreate failed. rc=%Rrc\n", rc));