reactos/ntoskrnl
George Bișoc 4471ee4dfa
[NTOS:SE] Properly handle dynamic counters in token
On current master, ReactOS faces these problems:

- ObCreateObject charges both paged and non paged pool a size of TOKEN structure, not the actual dynamic contents of WHAT IS inside a token. For paged pool charge the size is that of the dynamic area (primary group + default DACL if any). This is basically what DynamicCharged is for.
For the non paged pool charge, the actual charge is that of TOKEN structure upon creation. On duplication and filtering however, the paged pool charge size is that of the inherited dynamic charged space from an existing token whereas the non paged pool size is that of the calculated token body
length for the new duplicated/filtered token. On current master, we're literally cheating the kernel by charging the wrong amount of quota not taking into account the dynamic contents which they come from UM.

- Both DynamicCharged and DynamicAvailable are not fully handled (DynamicAvailable is pretty much poorly handled with some cases still to be taking into account). DynamicCharged is barely handled, like at all.

- As a result of these two points above, NtSetInformationToken doesn't check when the caller wants to set up a new default token DACL or primary group if the newly DACL or the said group exceeds the dynamic charged boundary. So what happens is that I'm going to act like a smug bastard fat politician and whack
the primary group and DACL of an token however I want to, because why in the hell not? In reality no, the kernel has to punish whoever attempts to do that, although we currently don't.

- The dynamic area (aka DynamicPart) only picks up the default DACL but not the primary group as well. Generally the dynamic part is composed of primary group and default DACL, if provided.

In addition to that, we aren't returning the dynamic charged and available area in token statistics. SepComputeAvailableDynamicSpace helper is here to accommodate that. Apparently Windows is calculating the dynamic available area rather than just querying the DynamicAvailable field directly from the token.
My theory regarding this is like the following: on Windows both TokenDefaultDacl and TokenPrimaryGroup classes are barely used by the system components during startup (LSASS provides both a DACL and primary group when calling NtCreateToken anyway). In fact DynamicAvailable is 0 during token creation, duplication and filtering when inspecting a token with WinDBG. So
if an application wants to query token statistics that application will face a dynamic available space of 0.
2022-06-29 10:06:37 +02:00
..
cache [NTOS:MM] Fix another instance of reentrant spinlock acquisition 2021-06-29 11:49:20 +02:00
cc [NTOS:CC] Unintialize private cache maps before purging the cache section 2022-02-02 17:45:59 +01:00
config [NTOS:CM] Adapt cmboot.c for usage in NT/ReactOS bootloader. 2022-04-16 18:37:45 +02:00
dbgk [NTOSKRNL] Regroup the pool allocation tags in one dedicated place 2021-12-27 18:57:03 +01:00
ex [NTOSKRNL] Force a probe against ReturnLength on query & Misc ICIF stuff 2022-06-12 11:05:05 +02:00
fsrtl [NTOS:FSRTL] Assign the buffer length to ThisBufferLength field 2022-01-11 10:11:08 +01:00
fstub [NTOS:IO/FSTUB] Fix the determination of 'SingleDisk' in IoGetBootDiskInformation(). 2021-06-11 02:21:47 +02:00
inbv [NTOS:INBV] Code refactoring: Move all the boot animation-specific code out of inbv.c and into the new bootanim.c file. 2022-02-13 21:29:14 +01:00
include [NTOS:SE] Properly handle dynamic counters in token 2022-06-29 10:06:37 +02:00
io [NTOSKRNL] Force a probe against ReturnLength on query & Misc ICIF stuff 2022-06-12 11:05:05 +02:00
kd [NTOS:KD][NTOS:KD64][NTOS:KDBG] Fix IRQL & spinlock use 2021-06-29 11:49:20 +02:00
kd64 [NTOS:KD64,KE] IRQL is automatically adjusted during calls to KdEnterDebugger() and KdExitDebugger(). (#3942) 2021-09-12 18:20:32 +02:00
kdbg [NTOSKRNL] Regroup the pool allocation tags in one dedicated place 2021-12-27 18:57:03 +01:00
ke [NTOS:KE] Fully implement FPU Save/Restore mechanism 2022-05-24 18:39:45 +02:00
lpc [NTOS:LPC] NtReplyWaitReceivePortEx returns the correct TotalLength for connect messages 2021-11-24 18:59:16 +01:00
mm [NTOS:MM] Fix memory leak in NtAllocateVirtualMemory 2022-06-04 22:44:27 +02:00
ntkrnlmp [CMAKE] Use the "kernel" module type for ntoskrnl and ntkrnlmp 2021-03-23 11:18:43 +01:00
ob [NTOS:OB] Include the security descriptor charge when charging the paged pool quota of an object 2022-06-26 19:47:02 +02:00
po [NTOSKRNL] Regroup the pool allocation tags in one dedicated place 2021-12-27 18:57:03 +01:00
ps [NTOSKRNL] Force a probe against ReturnLength on query & Misc ICIF stuff 2022-06-12 11:05:05 +02:00
rtl [RTL] Implement dynamic function tables for x64 2022-06-25 21:45:47 +02:00
se [NTOS:SE] Properly handle dynamic counters in token 2022-06-29 10:06:37 +02:00
tests
vdm [FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces 2021-06-11 15:33:08 +03:00
vf
wmi [REACTOS] Fix traces with missing arguments. 2021-11-21 12:57:35 -05:00
CMakeLists.txt [CMAKE] Elimitate the use of GCC and CLANG variables 2022-05-27 01:37:34 +03:00
guid.c
KrnlFun.c
ntdll.S
ntos.cmake [NTOS:SE] Reorganize the security manager component 2022-05-29 20:22:19 +02:00
ntoskrnl.rc
ntoskrnl.spec [ARM] Fix some compilation errors for ARM 2021-09-09 19:40:20 +03:00
sysfuncs.lst