reactos/ntoskrnl/include/internal
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
..
amd64 [NTOS:MM] MI_IS_*(): Improve documentation 2021-11-04 23:20:21 +03:00
arch Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
arm [NTOS:Mm] Rewrite MiWriteProtectSystemImage (#749) 2019-01-18 22:11:43 +01:00
i386 [NTOS:KE] Implement the internal FPU state context structure 2022-05-24 18:39:45 +02:00
cc.h [NTOS:CC] CcRosFlushVacb(): Fix Iosb annotation 2021-06-22 10:33:45 +02:00
cm.h [NTOS:CM] Adapt cmboot.c for usage in NT/ReactOS bootloader. 2022-04-16 18:37:45 +02:00
cm_x.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
cmboot.h [NTOS:CM] Adapt cmboot.c for usage in NT/ReactOS bootloader. 2022-04-16 18:37:45 +02:00
dbgk.h [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build 2021-05-12 11:04:29 +02:00
ex.h [NTOSKRNL] Implement InterlockedExchangeSizeT macro 2022-01-11 10:10:56 +01:00
fsrtl.h [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build 2021-05-12 11:04:29 +02:00
hal.h [FSTUB] Fix bugs from 8d2fe54188 2020-12-07 19:50:51 +03:00
hdl.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
icif.h [NTOSKRNL] Force a probe against ReturnLength on query & Misc ICIF stuff 2022-06-12 11:05:05 +02:00
inbv.h [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
io.h [NTOS:PNP] Halfplement IoInvalidateDeviceState 2022-04-27 02:42:20 +03:00
io_i.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
io_x.h [NTOS:IO] Use a guarded region in IopQueueIrpToThread. 2021-11-20 14:58:51 -05:00
kd.h [NTOS] Remove ROS-specific __NTOSKRNL__ 2022-05-07 17:53:51 +02:00
kd64.h [NTOS:KD][NTOS:KD64][NTOS:KDBG] Fix IRQL & spinlock use 2021-06-29 11:49:20 +02:00
ke.h [NTOS:KE] Unconditionally check IRQL when acquiring & releasing spinlock at DISPATCH_LEVEL 2021-06-29 11:49:20 +02:00
ke_x.h [NTOS:IO] Use a guarded region in IopQueueIrpToThread. 2021-11-20 14:58:51 -05:00
ldr.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
lpc.h [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build 2021-05-12 11:04:29 +02:00
lpc_x.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
mm.h [NTOS:MM] Add the pool quota prototypes and some definitions 2022-01-11 10:11:08 +01:00
napi.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
ntoskrnl.h [NTOSKRNL] Move the ICIF related code and stuff into a separate header file 2021-05-02 20:49:06 +02:00
ob.h [NTOS:OB] Add a system process quota block macro 2022-01-11 10:11:09 +01:00
ob_x.h [NTOS:OB] Clarify and fix the usage of the Obp*DirectoryLock*() and ObpReleaseLookupContextObject() functions. 2021-09-25 00:47:43 +02:00
po.h [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build 2021-05-12 11:04:29 +02:00
probe.h [NTOSKRNL] Force a probe against ReturnLength on query & Misc ICIF stuff 2022-06-12 11:05:05 +02:00
ps.h [NTOS:PS] Declare some prototypes and annotate the quota functions with SAL 2022-01-11 10:11:09 +01:00
ps_i.h [NTOS:PS] Support using QUOTA_LIMITS_EX in NtSetInformationProcess(ProcessQuotaLimits) 2021-07-15 19:33:45 +02:00
ps_x.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
rtl.h [NTOS:PS] On x64 don't fail in NtSetInformationProcess with ProcessUserModeIOPL information class, instead just don't do anything. 2020-09-20 23:08:17 +02:00
se.h [NTOS:SE] Properly handle dynamic counters in token 2022-06-29 10:06:37 +02:00
spinlock.h [NTOS:KE] Test spinlock ownership on both UP & MP build 2021-06-29 11:49:20 +02:00
tag.h [NTOSKRNL] Add FPU pool tags 2022-05-24 18:39:45 +02:00
test.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
vdm.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00