Author: tfaber Date: Mon Jan 28 18:27:21 2013 New Revision: 58246
URL: http://svn.reactos.org/svn/reactos?rev=58246&view=rev Log: [NTOSKRNL:MM] - Add a DPRINT with more info to the 'Hash == TableMask' assertion - Validate pool tags on free also for big allocations - Validate pool tag earlier, before tracking the free operation CORE-6929
Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Mon Jan 28 18:27:21 2013 @@ -570,7 +570,12 @@ // We should have only ended up with an empty entry if we've reached // the last bucket // - if (!TableEntry->Key) ASSERT(Hash == TableMask); + if (!TableEntry->Key) + { + DPRINT1("Empty item reached in tracker table. Tag=0x%08lx, NumberOfBytes=%lu, PoolType=%d\n", + Key, (ULONG)NumberOfBytes, PoolType); + ASSERT(Hash == TableMask); + }
// // This path is hit when we don't have an entry, and the current bucket @@ -2072,6 +2077,15 @@ }
// + // Check block tag + // + if (TagToFree && TagToFree != Tag) + { + DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Tag); + KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Tag, TagToFree); + } + + // // We have our tag and our page count, so we can go ahead and remove this // tracker now // @@ -2144,20 +2158,20 @@ if (Tag & PROTECTED_POOL) Tag &= ~PROTECTED_POOL;
// - // Stop tracking this allocation + // Check block tag + // + if (TagToFree && TagToFree != Tag) + { + DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Tag); + KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Tag, TagToFree); + } + + // + // Track the removal of this allocation // ExpRemovePoolTracker(Tag, BlockSize * POOL_BLOCK_SIZE, Entry->PoolType - 1); - - // - // Check block tag - // - if (TagToFree && TagToFree != Tag) - { - DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Tag); - KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Tag, TagToFree); - }
// // Is this allocation small enough to have come from a lookaside list?