Author: tfaber Date: Sun Mar 29 06:04:19 2015 New Revision: 66948
URL: http://svn.reactos.org/svn/reactos?rev=66948&view=rev Log: [NTOSKRNL] - More pool tagging!
Modified: trunk/reactos/ntoskrnl/include/internal/tag.h trunk/reactos/ntoskrnl/lpc/connect.c trunk/reactos/ntoskrnl/po/events.c trunk/reactos/ntoskrnl/po/power.c trunk/reactos/ntoskrnl/rtl/libsupp.c trunk/reactos/ntoskrnl/se/access.c trunk/reactos/ntoskrnl/se/audit.c trunk/reactos/ntoskrnl/se/priv.c trunk/reactos/ntoskrnl/se/sd.c
Modified: trunk/reactos/ntoskrnl/include/internal/tag.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/t... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/tag.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/tag.h [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -164,16 +164,14 @@ /* formerly located in rtl/handle.c */ #define TAG_HDTB 'BTDH'
-/* formerly located in se/acl.c */ -#define TAG_ACL 'cAeS' - -/* formerly located in se/sid.c */ -#define TAG_SID 'iSeS' - -/* formerly located in se/sd.c */ -#define TAG_SD 'dSeS' - -/* formerly located in se/token.c */ +/* Security Manager Tags */ +#define TAG_SE ' eS' +#define TAG_ACL 'cAeS' +#define TAG_SID 'iSeS' +#define TAG_SD 'dSeS' +#define TAG_QOS 'sQeS' +#define TAG_LUID 'uLeS' +#define TAG_PRIVILEGE_SET 'rPeS' #define TAG_TOKEN_USERS 'uKOT' #define TAG_TOKEN_PRIVILAGES 'pKOT' #define TAG_TOKEN_ACL 'kDOT'
Modified: trunk/reactos/ntoskrnl/lpc/connect.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/connect.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/connect.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/lpc/connect.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -164,7 +164,7 @@ //Status = SeQueryInformationToken(Token, TokenUser, (PVOID*)&TokenUserInfo); // FIXME: Need SeQueryInformationToken Status = STATUS_SUCCESS; - TokenUserInfo = ExAllocatePool(PagedPool, sizeof(TOKEN_USER)); + TokenUserInfo = ExAllocatePoolWithTag(PagedPool, sizeof(TOKEN_USER), TAG_SE); TokenUserInfo->User.Sid = ServerSid; PsDereferencePrimaryToken(Token);
@@ -179,7 +179,7 @@ }
/* Free token information */ - ExFreePool(TokenUserInfo); + ExFreePoolWithTag(TokenUserInfo, TAG_SE); } } else
Modified: trunk/reactos/ntoskrnl/po/events.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/events.c?rev=66... ============================================================================== --- trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -91,7 +91,7 @@ if (!SysButtonContext->WorkItem) { DPRINT("IoAllocateWorkItem() failed\n"); - ExFreePool(SysButtonContext); + ExFreePoolWithTag(SysButtonContext, 'IWOP'); return STATUS_SUCCESS; } IoQueueWorkItem( @@ -139,7 +139,7 @@ else { DPRINT1("IoBuildDeviceIoControlRequest() failed\n"); - ExFreePool(SysButtonContext); + ExFreePoolWithTag(SysButtonContext, 'IWOP'); }
IoFreeWorkItem(CurrentWorkItem); @@ -258,10 +258,12 @@ DPRINT(" )\n"); }
- SysButtonContext = ExAllocatePool(NonPagedPool, sizeof(SYS_BUTTON_CONTEXT)); + SysButtonContext = ExAllocatePoolWithTag(NonPagedPool, + sizeof(SYS_BUTTON_CONTEXT), + 'IWOP'); if (!SysButtonContext) { - DPRINT1("ExAllocatePool() failed\n"); + DPRINT1("ExAllocatePoolWithTag() failed\n"); ZwClose(FileHandle); return STATUS_INSUFFICIENT_RESOURCES; } @@ -273,7 +275,7 @@ { DPRINT1("IoAllocateWorkItem() failed\n"); ZwClose(FileHandle); - ExFreePool(SysButtonContext); + ExFreePoolWithTag(SysButtonContext, 'IWOP'); return STATUS_INSUFFICIENT_RESOURCES; } IoQueueWorkItem(
Modified: trunk/reactos/ntoskrnl/po/power.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=669... ============================================================================== --- trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -59,7 +59,7 @@ IoFreeIrp(Irp);
ObDereferenceObject(RequestPowerItem->TopDeviceObject); - ExFreePool(Context); + ExFreePoolWithTag(Context, 'IRoP');
return STATUS_MORE_PROCESSING_REQUIRED; } @@ -528,7 +528,9 @@ && MinorFunction != IRP_MN_WAIT_WAKE) return STATUS_INVALID_PARAMETER_2;
- RequestPowerItem = ExAllocatePool(NonPagedPool, sizeof(REQUEST_POWER_ITEM)); + RequestPowerItem = ExAllocatePoolWithTag(NonPagedPool, + sizeof(REQUEST_POWER_ITEM), + 'IRoP'); if (!RequestPowerItem) return STATUS_INSUFFICIENT_RESOURCES;
@@ -544,7 +546,7 @@ if (!Irp) { ObDereferenceObject(TopDeviceObject); - ExFreePool(RequestPowerItem); + ExFreePoolWithTag(RequestPowerItem, 'IRoP'); return STATUS_INSUFFICIENT_RESOURCES; }
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -14,6 +14,7 @@ #include <debug.h>
#define TAG_ATMT 'TotA' /* Atom table */ +#define TAG_RTHL 'LHtR' /* Heap Lock */
extern ULONG NtGlobalFlag;
@@ -159,7 +160,7 @@ RtlDeleteHeapLock(IN OUT PHEAP_LOCK Lock) { ExDeleteResourceLite(&Lock->Resource); - ExFreePool(Lock); + ExFreePoolWithTag(Lock, TAG_RTHL);
return STATUS_SUCCESS; } @@ -200,7 +201,9 @@ NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock) { - PHEAP_LOCK HeapLock = ExAllocatePool(NonPagedPool, sizeof(HEAP_LOCK)); + PHEAP_LOCK HeapLock = ExAllocatePoolWithTag(NonPagedPool, + sizeof(HEAP_LOCK), + TAG_RTHL); if (HeapLock == NULL) return STATUS_NO_MEMORY;
@@ -580,8 +583,9 @@ PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size) { - PRTL_ATOM_TABLE Table = ExAllocatePool(NonPagedPool, - Size); + PRTL_ATOM_TABLE Table = ExAllocatePoolWithTag(NonPagedPool, + Size, + TAG_ATMT); if (Table != NULL) { RtlZeroMemory(Table, @@ -594,7 +598,7 @@ VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable) { - ExFreePool(AtomTable); + ExFreePoolWithTag(AtomTable, TAG_ATMT); }
PRTL_ATOM_TABLE_ENTRY
Modified: trunk/reactos/ntoskrnl/se/access.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/access.c?rev=66... ============================================================================== --- trunk/reactos/ntoskrnl/se/access.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/access.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -460,7 +460,8 @@ AuxData = AccessState->AuxData;
/* Deallocate Privileges */ - if (AccessState->PrivilegesAllocated) ExFreePool(AuxData->PrivilegeSet); + if (AccessState->PrivilegesAllocated) + ExFreePoolWithTag(AuxData->PrivilegeSet, TAG_PRIVILEGE_SET);
/* Deallocate Name and Type Name */ if (AccessState->ObjectName.Buffer)
Modified: trunk/reactos/ntoskrnl/se/audit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/audit.c?rev=669... ============================================================================== --- trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -1113,7 +1113,7 @@ /* Allocate a temp buffer */ CapturedPrivilegeSet = ExAllocatePoolWithTag(PagedPool, PrivilegeSetSize, - 'rPeS'); + TAG_PRIVILEGE_SET); if (CapturedPrivilegeSet == NULL) { DPRINT1("Failed to allocate %u bytes\n", PrivilegeSetSize); @@ -1215,7 +1215,7 @@ SeReleaseSecurityDescriptor(CapturedSecurityDescriptor, UserMode, FALSE);
if (CapturedPrivilegeSet != NULL) - ExFreePoolWithTag(CapturedPrivilegeSet, 'rPeS'); + ExFreePoolWithTag(CapturedPrivilegeSet, TAG_PRIVILEGE_SET);
/* Release the security subject context */ SeReleaseSubjectContext(&SubjectContext); @@ -1336,7 +1336,7 @@ /* Allocate a temp buffer */ CapturedPrivileges = ExAllocatePoolWithTag(PagedPool, PrivilegesSize, - 'rPeS'); + TAG_PRIVILEGE_SET); if (CapturedPrivileges == NULL) { DPRINT1("Failed to allocate %u bytes\n", PrivilegesSize); @@ -1375,7 +1375,7 @@ ReleaseCapturedUnicodeString(&CapturedServiceName, PreviousMode);
if (CapturedPrivileges != NULL) - ExFreePoolWithTag(CapturedPrivileges, 'rPeS'); + ExFreePoolWithTag(CapturedPrivileges, TAG_PRIVILEGE_SET);
/* Release the security subject context */ SeReleaseSubjectContext(&SubjectContext);
Modified: trunk/reactos/ntoskrnl/se/priv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/priv.c?rev=6694... ============================================================================== --- trunk/reactos/ntoskrnl/se/priv.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/priv.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -219,7 +219,7 @@ { /* Calculate size and allocate the structure */ PrivilegeSize = FIELD_OFFSET(PRIVILEGE_SET, Privilege[PrivilegeCount]); - PrivilegeSet = ExAllocatePoolWithTag(PagedPool, PrivilegeSize, 'rPeS'); + PrivilegeSet = ExAllocatePoolWithTag(PagedPool, PrivilegeSize, TAG_PRIVILEGE_SET); *OutPrivilegeSet = PrivilegeSet; if (PrivilegeSet == NULL) { @@ -352,8 +352,9 @@ } else { - *Dest = ExAllocatePool(PoolType, - BufferSize); + *Dest = ExAllocatePoolWithTag(PoolType, + BufferSize, + TAG_LUID); if (*Dest == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -375,7 +376,7 @@
if (!NT_SUCCESS(Status) && AllocatedMem == NULL) { - ExFreePool(*Dest); + ExFreePoolWithTag(*Dest, TAG_LUID); }
return Status; @@ -392,7 +393,7 @@ if (Privilege != NULL && (PreviousMode != KernelMode || CaptureIfKernel)) { - ExFreePool(Privilege); + ExFreePoolWithTag(Privilege, TAG_LUID); } }
@@ -428,7 +429,9 @@ Privileges->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES);
/* Allocate a new privilege set */ - PrivilegeSet = ExAllocatePool(PagedPool, NewPrivilegeSetSize); + PrivilegeSet = ExAllocatePoolWithTag(PagedPool, + NewPrivilegeSetSize, + TAG_PRIVILEGE_SET); if (PrivilegeSet == NULL) return STATUS_INSUFFICIENT_RESOURCES;
@@ -447,7 +450,7 @@
/* Free the old privilege set if it was allocated */ if (AccessState->PrivilegesAllocated != FALSE) - ExFreePool(AuxData->PrivilegeSet); + ExFreePoolWithTag(AuxData->PrivilegeSet, TAG_PRIVILEGE_SET);
/* Now we are using an allocated privilege set */ AccessState->PrivilegesAllocated = TRUE; @@ -477,7 +480,7 @@ SeFreePrivileges(IN PPRIVILEGE_SET Privileges) { PAGED_CODE(); - ExFreePool(Privileges); + ExFreePoolWithTag(Privileges, TAG_PRIVILEGE_SET); }
/*
Modified: trunk/reactos/ntoskrnl/se/sd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sd.c?rev=66948&... ============================================================================== --- trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] Sun Mar 29 06:04:19 2015 @@ -281,8 +281,9 @@ { if (*Present) { - CapturedQos = ExAllocatePool(PoolType, - sizeof(SECURITY_QUALITY_OF_SERVICE)); + CapturedQos = ExAllocatePoolWithTag(PoolType, + sizeof(SECURITY_QUALITY_OF_SERVICE), + TAG_QOS); if (CapturedQos != NULL) { RtlCopyMemory(CapturedQos, @@ -312,8 +313,9 @@ if (((PSECURITY_QUALITY_OF_SERVICE)ObjectAttributes->SecurityQualityOfService)->Length == sizeof(SECURITY_QUALITY_OF_SERVICE)) { - CapturedQos = ExAllocatePool(PoolType, - sizeof(SECURITY_QUALITY_OF_SERVICE)); + CapturedQos = ExAllocatePoolWithTag(PoolType, + sizeof(SECURITY_QUALITY_OF_SERVICE), + TAG_QOS); if (CapturedQos != NULL) { RtlCopyMemory(CapturedQos, @@ -371,7 +373,7 @@ if (CapturedSecurityQualityOfService != NULL && (AccessMode != KernelMode || CaptureIfKernel)) { - ExFreePool(CapturedSecurityQualityOfService); + ExFreePoolWithTag(CapturedSecurityQualityOfService, TAG_QOS); } }
@@ -904,9 +906,11 @@ } SaclLength = Sacl ? ROUND_UP((ULONG)Sacl->AclSize, 4) : 0;
- NewSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR_RELATIVE) + OwnerLength + GroupLength + - DaclLength + SaclLength); + NewSd = ExAllocatePoolWithTag(NonPagedPool, + sizeof(SECURITY_DESCRIPTOR_RELATIVE) + + OwnerLength + GroupLength + + DaclLength + SaclLength, + TAG_SD); if (NewSd == NULL) { return STATUS_INSUFFICIENT_RESOURCES;