[NTOS:KE] Fix some locking issues

This commit is contained in:
Timo Kreuzer 2021-06-07 10:23:01 +02:00
parent 62f62da8ba
commit a011d19ed2
4 changed files with 10 additions and 0 deletions

View file

@ -1347,6 +1347,8 @@ KxUnwaitThreadForEvent(IN PKEVENT Event,
// This routine must be entered with the PRCB lock held and it will exit
// with the PRCB lock released!
//
_Requires_lock_held_(Prcb->PrcbLock)
_Releases_lock_(Prcb->PrcbLock)
FORCEINLINE
VOID
KxQueueReadyThread(IN PKTHREAD Thread,

View file

@ -26,6 +26,7 @@ NTSTATUS
KiConvertToGuiThread(
VOID);
_Requires_lock_not_held_(Prcb->PrcbLock)
VOID
NTAPI
KiDpcInterruptHandler(VOID)
@ -61,6 +62,9 @@ KiDpcInterruptHandler(VOID)
}
else if (Prcb->NextThread)
{
/* Acquire the PRCB lock */
KiAcquirePrcbLock(Prcb);
/* Capture current thread data */
OldThread = Prcb->CurrentThread;
NewThread = Prcb->NextThread;

View file

@ -460,6 +460,7 @@ KiTimerListExpire(IN PLIST_ENTRY ExpiredListHead,
}
}
_Requires_lock_not_held_(Prcb->PrcbLock)
VOID
NTAPI
KiQuantumEnd(VOID)

View file

@ -367,6 +367,9 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process,
/* Lock the process */
KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtSynchLevel();
/* Check if we are modifying the quantum too */
if (Quantum) Process->QuantumReset = Quantum;