Author: sir_richard
Date: Sat Jun 5 18:53:54 2010
New Revision: 47592
URL: http://svn.reactos.org/svn/reactos?rev=47592&view=rev
Log:
[NTOS]: Define the POOL_HEADER for x64.
[NTOS]: Define POOL_BLOCK_SIZE definition to set the minimum pool block size. In NT, this is equal to a LIST_ENTRY structure, because the Pool Allocator must be able to store a LIST_ENTRY into a freed pool block. This also determines the alignment of pool allocations. So 8 on x86, 16 on x64.
[NTOS]: Don't depend on LIST_ENTRY, but use POOL_BLOCK_SIZE instead (on IA64, if we ever want to support this, the pool block size is different from a LIST_ENTRY/POOL_HEADER).
[NTOS]: The following ASSERTs must hold: the POOL_HEADER must be as big as the the smallest pool block (POOL_BLOCK_SIZE), which must be at least as big as a LIST_ENTRY structure. 8 == 8 == 8 on x86, 16 == 16 == 16 on x64.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sat Jun 5 18:53:54 2010
@@ -225,13 +225,18 @@
// Special IRQL value (found in assertions)
//
#define MM_NOIRQL (KIRQL)0xFFFFFFFF
-
+
//
// FIXFIX: These should go in ex.h after the pool merge
//
-#define POOL_LISTS_PER_PAGE (PAGE_SIZE / sizeof(LIST_ENTRY))
+#ifdef _M_AMD64
+#define POOL_BLOCK_SIZE 16
+#else
+#define POOL_BLOCK_SIZE 8
+#endif
+#define POOL_LISTS_PER_PAGE (PAGE_SIZE / POOL_BLOCK_SIZE)
#define BASE_POOL_TYPE_MASK 1
-#define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + sizeof(LIST_ENTRY)))
+#define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + POOL_BLOCK_SIZE))
typedef struct _POOL_DESCRIPTOR
{
@@ -256,16 +261,30 @@
{
struct
{
+#ifdef _M_AMD64
+ ULONG PreviousSize:8;
+ ULONG PoolIndex:8;
+ ULONG BlockSize:8;
+ ULONG PoolType:8;
+#else
USHORT PreviousSize:9;
USHORT PoolIndex:7;
USHORT BlockSize:9;
USHORT PoolType:7;
+#endif
};
ULONG Ulong1;
};
+#ifdef _M_AMD64
+ ULONG PoolTag;
+#endif
union
{
+#ifdef _M_AMD64
+ PEPROCESS ProcessBilled;
+#else
ULONG PoolTag;
+#endif
struct
{
USHORT AllocatorBackTraceIndex;
@@ -274,11 +293,8 @@
};
} POOL_HEADER, *PPOOL_HEADER;
-//
-// Everything depends on this
-//
-C_ASSERT(sizeof(POOL_HEADER) == 8);
-C_ASSERT(sizeof(POOL_HEADER) == sizeof(LIST_ENTRY));
+C_ASSERT(sizeof(POOL_HEADER) == POOL_BLOCK_SIZE);
+C_ASSERT(POOL_BLOCK_SIZE == sizeof(LIST_ENTRY));
extern ULONG ExpNumberOfPagedPools;
extern POOL_DESCRIPTOR NonPagedPoolDescriptor;
Author: sir_richard
Date: Sat Jun 5 16:59:50 2010
New Revision: 47589
URL: http://svn.reactos.org/svn/reactos?rev=47589&view=rev
Log:
[NTOS]: Don't assume that ANY fault in the system address range, not associated to a memory area, might be ARM3. Instead, since this hack only exists for early boot page pool support, make only treat this as an ARM3 fault when it happens in the paged pool area or higher. Leads to more direct Mm crashes when invalid page access happens, instead of infinite "PAGE FAULT ON PAGE TABLES".
Modified:
trunk/reactos/ntoskrnl/mm/mmfault.c
Modified: trunk/reactos/ntoskrnl/mm/mmfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmfault.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] Sat Jun 5 16:59:50 2010
@@ -284,13 +284,13 @@
* can go away.
*/
MemoryArea = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), Address);
- if ((!(MemoryArea) && ((ULONG_PTR)Address >= (ULONG_PTR)MmSystemRangeStart)) ||
+ if ((!(MemoryArea) && ((ULONG_PTR)Address >= (ULONG_PTR)MmPagedPoolStart)) ||
((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3)))
{
//
// Hand it off to more competent hands...
//
- DPRINT1("ARM3 fault\n");
+ DPRINT1("ARM3 fault %p\n", MemoryArea);
return MmArmAccessFault(StoreInstruction, Address, Mode, TrapInformation);
}
Author: sir_richard
Date: Sat Jun 5 16:55:17 2010
New Revision: 47588
URL: http://svn.reactos.org/svn/reactos?rev=47588&view=rev
Log:
[NTOS]: In MiInitializePfnForOtherProcess, should increment the sharecount of the page table PFN entry, not the PFN entry of the PTE itself. Spotted by Stefan100.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] Sat Jun 5 16:55:17 2010
@@ -791,7 +791,7 @@
Pfn1->u4.PteFrame = PteFrame;
/* Increase its share count so we don't get rid of it */
- Pfn1 = MiGetPfnEntry(PageFrameIndex);
+ Pfn1 = MiGetPfnEntry(PteFrame);
Pfn1->u2.ShareCount++;
}
}
Author: sir_richard
Date: Sat Jun 5 16:54:26 2010
New Revision: 47587
URL: http://svn.reactos.org/svn/reactos?rev=47587&view=rev
Log:
[NTOS]: In MiDeleteSystemPageableVm, should also handle the case where the PTE is demand-zero. This can happen if the caller allocated, say, 12KB (3 pages) of paged pool, only touched 4KB (1 page), and then frees the allocation -- the other 2 pages will still be demand-zero at this point.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sat Jun 5 16:54:26 2010
@@ -64,7 +64,6 @@
/* As always, only handle current ARM3 scenarios */
ASSERT(PointerPte->u.Soft.Prototype == 0);
ASSERT(PointerPte->u.Soft.Transition == 0);
- ASSERT(PointerPte->u.Hard.Valid == 1);
/* Normally this is one possibility -- freeing a valid page */
if (PointerPte->u.Hard.Valid)
@@ -106,6 +105,20 @@
/* Actual legitimate pages */
ActualPages++;
}
+ else
+ {
+ /*
+ * The only other ARM3 possibility is a demand zero page, which would
+ * mean freeing some of the paged pool pages that haven't even been
+ * touched yet, as part of a larger allocation.
+ *
+ * Right now, we shouldn't expect any page file information in the PTE
+ */
+ ASSERT(PointerPte->u.Soft.PageFileHigh == 0);
+
+ /* Destroy the PTE */
+ PointerPte->u.Long = 0;
+ }
/* Keep going */
PointerPte++;
Author: ekohl
Date: Sat Jun 5 14:20:53 2010
New Revision: 47586
URL: http://svn.reactos.org/svn/reactos?rev=47586&view=rev
Log:
[NTOSKRNL]
NtDuplicateToken: Fail, if a primary token is to be created from an impersonation token and and the impersonation level of the impersonation token is below SecurityImpersonation.
Modified:
trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/ntoskrnl/se/token.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=47…
==============================================================================
--- trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] Sat Jun 5 14:20:53 2010
@@ -1871,6 +1871,21 @@
}
}
+ /*
+ * Fail, if a primary token is to be created from an impersonation token
+ * and and the impersonation level of the impersonation token is below SecurityImpersonation.
+ */
+ if (Token->TokenType == TokenImpersonation &&
+ TokenType == TokenPrimary &&
+ Token->ImpersonationLevel < SecurityImpersonation)
+ {
+ ObDereferenceObject(Token);
+ SepReleaseSecurityQualityOfService(CapturedSecurityQualityOfService,
+ PreviousMode,
+ FALSE);
+ return STATUS_BAD_IMPERSONATION_LEVEL;
+ }
+
Status = SepDuplicateToken(Token,
ObjectAttributes,
EffectiveOnly,