[NTOSKRNL] Misc fixes to VACB reference counting

This fixes various bugs linked to VACB counting:
- VACB not released when it should be
- Reference count expectations not being accurate

For the record, VACB should always have at least a reference
count of 1, unless you are to free it and removed it from
any linked list.

This commit also adds a bunch of asserts that should
help triggering invalid reference counting.

It should also fix numerous ASSERT currently triggered and
may help fixing random behaviours in Cc.

CORE-14285
CORE-14401
CORE-14293
This commit is contained in:
Pierre Schweitzer 2018-03-17 11:56:25 +01:00
parent ad3bda1c8d
commit 13b57fb5b5
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
4 changed files with 63 additions and 26 deletions

View file

@ -519,3 +519,24 @@ IsPointInRange(
}
#define CcBugCheck(A, B, C) KeBugCheckEx(CACHE_MANAGER, BugCheckFileId | ((ULONG)(__LINE__)), A, B, C)
#if DBG
#define CcRosVacbIncRefCount(vacb) CcRosVacbIncRefCount_(vacb,__FILE__,__LINE__)
#define CcRosVacbDecRefCount(vacb) CcRosVacbDecRefCount_(vacb,__FILE__,__LINE__)
VOID
CcRosVacbIncRefCount_(
PROS_VACB vacb,
PCSTR file,
INT line);
VOID
CcRosVacbDecRefCount_(
PROS_VACB vacb,
PCSTR file,
INT line);
#else
#define CcRosVacbIncRefCount(vacb) (++((vacb)->ReferenceCount))
#define CcRosVacbDecRefCount(vacb) (--((vacb)->ReferenceCount))
#endif