[NTOS:EX]

- Use the calling thread instead of the passed-in thread to validate APC status in ExReleaseResourceForThreadLite. The latter can be user-set and might not be a KTHREAD at all.
CORE-11315 #resolve

svn path=/trunk/; revision=71398
This commit is contained in:
Thomas Faber 2016-05-25 10:27:17 +00:00
parent 6305b9d645
commit 412f0d26d0
2 changed files with 6 additions and 2 deletions

View file

@ -1817,7 +1817,7 @@ FASTCALL
ExReleaseResourceLite(IN PERESOURCE Resource)
{
/* Just call the For-Thread function */
ExReleaseResourceForThreadLite(Resource, (ERESOURCE_THREAD)PsGetCurrentThread());
ExReleaseResourceForThreadLite(Resource, ExGetCurrentResourceThread());
}
/*++
@ -1855,7 +1855,7 @@ ExReleaseResourceForThreadLite(IN PERESOURCE Resource,
/* Sanity checks */
ExpVerifyResource(Resource);
ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, (PKTHREAD)Thread);
ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, KeGetCurrentThread());
/* Check if it's exclusively owned */
if (IsOwnedExclusive(Resource))

View file

@ -504,6 +504,10 @@ TestResourceWithOwner(
InitThreadDataEx(&ThreadDataOwner, Res, ExAcquireResourceExclusiveLite, TestOwnerRes);
KeEnterCriticalRegion();
ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned");
ExSetResourceOwnerPointer(Res, (PVOID)(ULONG_PTR)3);
ExReleaseResourceForThreadLite(Res, 3);
ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned");
ExSetResourceOwnerPointer(Res, (PVOID)((ULONG_PTR)Res | 3));
KeLeaveCriticalRegion();