https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6d701b4b05c465e1e01ab…
commit 6d701b4b05c465e1e01abd911949c9645e193f0f
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Oct 9 21:39:35 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Oct 24 21:45:27 2023 +0300
[NTOS:MM] Add ASSERTS to MmLockAddressSpace to guarantee lock ordering
---
ntoskrnl/include/internal/mm.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index f637014794a..d1dad7a25c1 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -1690,6 +1690,12 @@ FORCEINLINE
VOID
MmLockAddressSpace(PMMSUPPORT AddressSpace)
{
+ ASSERT(!PsGetCurrentThread()->OwnsProcessWorkingSetExclusive);
+ ASSERT(!PsGetCurrentThread()->OwnsProcessWorkingSetShared);
+ ASSERT(!PsGetCurrentThread()->OwnsSystemWorkingSetExclusive);
+ ASSERT(!PsGetCurrentThread()->OwnsSystemWorkingSetShared);
+ ASSERT(!PsGetCurrentThread()->OwnsSessionWorkingSetExclusive);
+ ASSERT(!PsGetCurrentThread()->OwnsSessionWorkingSetShared);
KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS,
Vm)->AddressCreationLock);
}