Commit graph

1011 commits

Author SHA1 Message Date
George Bișoc a340ec1767
[NTOS:PS] Guard the quota in a spin lock (#3419)
Prior to acquiring a quota from the process and do whatever it's needed to do (charge it or return it back), we must guard ourselves with a spinlock so that we may not get into potential race conditions. In Windows Server 2003, PspGivebackQuota and PspExpandQuota do the same thing and they're the equivalent to PspReturnProcessQuotaSpecifiedPool and PspChargeProcessQuotaSpecifiedPool in our codebase.
2021-03-04 04:43:30 +03:00
Serge Gautherie 7851ad8635 [NTOS:KD] KdpDebugLogInit(): Close the thread handle
Addendum to 07dc415 (r43331).
2021-03-03 09:01:37 +01:00
Serge Gautherie 802ad6d3ee [NTOS:KD] KdpLoggerThread(): Assert being in kernel mode
to be explicit that using Nt*() is safe.

Follow-up to 9537653.
2021-03-03 09:01:37 +01:00
George Bișoc 6170b574f0
[NTOS:PS] Implement PS_QUOTA_TYPE and let the quota code use it (#3389)
This will replace the PoolIndex variable and as such we'll only be using the PS_QUOTA_TYPE enumeration, as Windows does. Both QuotaEntry, QuotaUsage and QuotaPeak depend explicitly or implicitly on this enumeration. Further details about this enum can be found in the following articles.
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ps/psquota/type.htm?tx=68,143
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ps/psquota/block.htm?tx=68,142,143
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/ps/eprocess/index.htm (see QuotaPeak and QuotaUsage)
2021-03-02 20:09:58 +01:00
Jérôme Gardou 4e4c47cccc [NTOS:KE] Generate proper frame info for trap handler in GCC builds
CORE-8531
2021-03-02 14:37:39 +01:00
Jérôme Gardou 7caf9e9d48 [NTOS:KD] Use Zw* syscall variants
The log file can be (re-)initialized when previous mode is User-Mode,
thus the calls fail on probing input parameters
2021-02-26 08:46:53 +01:00
Jérôme Gardou a93e065ebc [NTOS:MM] Do not chunk-read file when we are the modified-page-writer thread 2021-02-26 08:46:53 +01:00
Jérôme Gardou 35c091adaf [NTOS:MM] Do not chunk-read files marked with FO_RANDOM_ACCESS 2021-02-26 08:46:53 +01:00
Eric Kohl 9ff015f770 [NTOS:CM] Report key creation to the notify code 2021-02-21 15:49:06 +01:00
Jérôme Gardou 2a962eaf8c [NTOS:CC] Keep a reference on the shared cache map of the file when we are in lazy write
This should fix "Leaking VACB" debug prints
2021-02-19 15:48:31 +01:00
Jérôme Gardou d18634c026 [NTOS:WMI] Be consistent about potential NULL pointer use 2021-02-18 10:24:53 +01:00
Serge Gautherie 17a9041da1 [NTOS:WMI] IoWMIWriteEvent(): Add WNODE_FLAG_TRACED_GUID case
Addendum to d5f8964 (r23040).
CORE-17384
2021-02-17 18:59:09 +01:00
Serge Gautherie 495e22e0d5 [NTOS:WMI] IoWMIWriteEvent(): Fix annotation, Extend DPRINT1()
CORE-17384
2021-02-17 18:59:09 +01:00
Timo Kreuzer 4b4bff0642 [NTOS:MM] Handle demand zero PTEs with MM_EXECUTE_READWRITE and MM_READWRITE 2021-02-16 18:02:57 +01:00
Hervé Poussineau 58332b076c [NTOS:KD] Merge initialization phases 1 and 2, and fix log file debugging
Phase 2 and 3 were not done anymore since 777a2d94da.

Fix that, by merging phases 1 and 2, and by calling phase 3 later
for log file debugging, when ExpInitializationPhase = 3

CORE-17470
2021-02-16 00:12:25 +01:00
Jérôme Gardou 0573de22a0 [NTOS:MM] Do not assert on a case we actually support 2021-02-10 17:48:30 +01:00
Jérôme Gardou 73fd52a164 [NTOS:MM] Flush dirty pages after closing the page files.
CORE-17462
2021-02-10 11:14:19 +01:00
Timo Kreuzer ca74467904
[NTOS:CC] Raise status, when CcMapData fails (#3348)
Also add a check in fastfat, that asserts, when CcMapData returns FALSE.
2021-02-09 09:29:48 +01:00
George Bișoc dd4c113594
[NTOS:SE] Do not use a global lock for tokens (#3445)
In Windows Server 2003 the lock is initialised on a per-token basis, that is, the lock resource is created in SepDuplicateToken() and SepCreateToken() functions. This ensures that the lock initialisation is done locally for the specific token thus avoiding the need of a global lock.
2021-02-05 12:10:19 +03:00
Victor Perevertkin b705df731e
[NTOS:MM][FASTFAT_NEW] Fix DBG usage, fixes Release build 2021-02-05 11:54:10 +03:00
Jérôme Gardou 6f2b94c023 [NTOS:MM] Wake up the balancer as soon as we are low on page.
Fixes installing on a system with 64MB of RAM, if you feel like it.
2021-02-03 13:42:39 +01:00
Jérôme Gardou cc9607e94e [NTOS:CC] Fix use of uninitialized variable 2021-02-03 13:35:17 +01:00
Jérôme Gardou 0699dcb50c [NTOS:EX] Restore sysinfo 2021-02-03 10:29:28 +01:00
Jérôme Gardou 14077e3f4e [NTOS:MM] Simplify a check 2021-02-03 09:41:24 +01:00
Jérôme Gardou b7eb0fddf3 Address PR review 2021-02-03 09:41:24 +01:00
Jérôme Gardou c0bf352069 [NTOS:MM] Fix regression of MmCanFileBeTruncated 2021-02-03 09:41:24 +01:00
Jérôme Gardou 7f7abc9838 [NTOS:MM] Simplify code & fix MSVC x64 build 2021-02-03 09:41:23 +01:00
Jérôme Gardou 2ba1926037 [NTOS:MM][NTOS:CC] Performance improvement again
Read files by 64kb chunks instead of page-sized chunks.
2021-02-03 09:41:23 +01:00
Jérôme Gardou 625f273361 [NTOS:MM] More fine-tuning of the memory balancer 2021-02-03 09:41:23 +01:00
Jérôme Gardou 41475dfcd7 [NTOS:CC] Performance improvements
Do not ditch the pages as soon as the section are unmapped
Improve MmBalancer "algorithm" (or whatever you call that)
Various needed fixes to get this going.
2021-02-03 09:41:23 +01:00
Jérôme Gardou 7fbf90d6fd [NTOS:CC] Fix a bug 2021-02-03 09:41:23 +01:00
Jérôme Gardou ea354c4bc7 [NTOS:MM] Unconditionally purge cache on image section creation. 2021-02-03 09:41:23 +01:00
Jérôme Gardou c1c51e31e4 [NTOS:MM] Keep a ref on the segment when mapping a page & keep trace of what is the highest offset mapped. 2021-02-03 09:41:23 +01:00
Jérôme Gardou 91a4e62376 [NTOS:MM] Improve MmCanFileBeTruncated 2021-02-03 09:41:23 +01:00
Jérôme Gardou 3e43aa1305 [NTOS:MM] Use 64-bit integer to count references on segments 2021-02-03 09:41:23 +01:00
Jérôme Gardou cc6bc02b91 [NTOS:CC] Make sure to purge the Mm side in CcPurgeCacheSection 2021-02-03 09:41:23 +01:00
Jérôme Gardou d0bf98663b [NTOS:CC] Be sure to flush the whole file in CcFlushCache 2021-02-03 09:41:23 +01:00
Jérôme Gardou 90c6a65efe [NTOS:MM] Introduce MmPurgeSegment & MmFlushSegment
Those will back CcFlushCache and CcPurgeCache.
2021-02-03 09:41:23 +01:00
Jérôme Gardou 8a8b4db447 [NTOS:MM] Make the page LRU list a real LRU list.
Also, implement flushing mapped sections to disk on shutdown.
2021-02-03 09:41:23 +01:00
Jérôme Gardou bde2ee571a [NTOS:FSRTL] Properly leave FsRtl when returning STATUS_CANT_WAIT 2021-02-03 09:41:23 +01:00
Jérôme Gardou 3efc5b1734 [NTOS:MM] Fix unlocking on failure path 2021-02-03 09:41:23 +01:00
Jérôme Gardou d23dbdda4c [NTOS:MM] Remove unused field 2021-02-03 09:41:23 +01:00
Jérôme Gardou f201b8af78 [NTOS:MM] Do not acquire Pfn lock in MmGetRmapListHead
All callers already hold it
2021-02-03 09:41:23 +01:00
Jérôme Gardou 727e73f253 |NTOS:MM] Simplify some code 2021-02-03 09:41:23 +01:00
Jérôme Gardou 48e1c8593f [NTOS:PO] Flush dirty pages after flushing volumes 2021-02-03 09:41:23 +01:00
Jérôme Gardou 5949d5095d [NTOS:CC][NTOS:MM] Try respecting ValidDataLength 2021-02-03 09:41:23 +01:00
Jérôme Gardou bdb73edab7 [NTOS:CC] Flush the whole VACB
Let Mm know what it has to do.
2021-02-03 09:41:23 +01:00
Jérôme Gardou 804f5a41ed [NTOS:CC] Improve trace messages 2021-02-03 09:41:23 +01:00
Jérôme Gardou 20fe42c9e9 [NTOS:CC] Simplify CcFlushCache implementation 2021-02-03 09:41:23 +01:00
Jérôme Gardou 9b6240ee03 [NTOS:CC] Get rid of ROS_VACB:Valid 2021-02-03 09:41:23 +01:00