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
Timo Kreuzer
4b4bff0642
[NTOS:MM] Handle demand zero PTEs with MM_EXECUTE_READWRITE and MM_READWRITE
2021-02-16 18:02:57 +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
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
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
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
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
3efc5b1734
[NTOS:MM] Fix unlocking on failure path
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
5949d5095d
[NTOS:CC][NTOS:MM] Try respecting ValidDataLength
2021-02-03 09:41:23 +01:00
Jérôme Gardou
e46f1a9af3
[NTOS:MM] Disable APC while performing Paged Read
2021-02-03 09:41:23 +01:00
Jérôme Gardou
8ed15a49a7
[NTOS:MM] Fix a race
2021-02-03 09:41:23 +01:00
Jérôme Gardou
11eee4eeec
[NTOS:MM] Check that we don't add rmap for NULL process
2021-02-03 09:41:23 +01:00
Jérôme Gardou
caf89b9582
[NTOS:MM] Fix a race condition when unmapping sections views
2021-02-03 09:41:23 +01:00
Jérôme Gardou
cff3c399c6
[NTOS:MM] Fix input validation/correction in MmMapViewInSystemSpace
2021-02-03 09:41:23 +01:00
Jérôme Gardou
addf824d87
[NTOS:MM] Keep image maps & file maps coherent at the time of creating the image map
2021-02-03 09:41:23 +01:00
Jérôme Gardou
543112008a
Fix physical memory section creation
2021-02-03 09:41:22 +01:00
Jérôme Gardou
674ab3dce3
[NTOS:MM] Remove a check for now
2021-02-03 09:41:22 +01:00
Jérôme Gardou
1f796267bc
[NTOS:MM] Do not reference the section when mapping it.
...
Referencing the segment is enough.
2021-02-03 09:41:22 +01:00
Jérôme Gardou
3c2b1bf59b
[NTOS:MM] Save the dirty bit when sharing a segment page
2021-02-03 09:41:22 +01:00
Jérôme Gardou
3141668724
[NTOS:MM] Various fixes.
...
Fix MmFlushImageSection behaviour
Remove an invalid ASSERT
2021-02-03 09:41:22 +01:00
Jérôme Gardou
30f71c7fc0
[NTOS] Zero data unconditionally after segment end, unless section is created with SEC_RESERVE
...
Use a SEC_RESERVE section in Cc
2021-02-03 09:41:22 +01:00
Jérôme Gardou
aab24ed1b1
[NTOS:MM] Have the legacy Mm be less greedy about the number of pages it wants
2021-02-03 09:41:22 +01:00
Jérôme Gardou
fb07802956
[NTOS:MM] Make the situation about dirty pages in image map a bit clearer
2021-02-03 09:41:22 +01:00
Jérôme Gardou
d9f7459bb1
[NTOS:MM] Fix file object bad referencing
2021-02-03 09:41:22 +01:00
Jérôme Gardou
e39fc52d25
[NTOS/MM] Set FSRTL_MOD_WRITE_TOP_LEVEL_IRP top-level IRP when paging-out
2021-02-03 09:41:22 +01:00
Jérôme Gardou
f114209782
[NTOS/MM] Do not zero out the tail of the segment if the mapping is not an image
2021-02-03 09:41:22 +01:00
Jérôme Gardou
7d70af61e8
[NTOS:MM] Acquire file lock when creating section
2021-02-03 09:41:22 +01:00
Jérôme Gardou
d2fa434cb7
[NTOSKRNL] Address issues raised in PR 3361 review
2021-02-03 09:41:22 +01:00
Jérôme Gardou
7dab3583cc
[NTOS/MM] Force flushing when the page is dirtified in user mode
2021-02-03 09:41:22 +01:00
Jérôme Gardou
91edefa11e
[NTOS:MM] Do not limit ourselves in reading or writing the file
2021-02-03 09:41:22 +01:00
Jérôme Gardou
774a4c703f
[NTOS/MM] Misc fixes
...
Purge data section object before creating an image mapping
Zero-out the tail of the page after reading from file
Properly map page as read-only when paging-in a COW memory map.
2021-02-03 09:41:22 +01:00
Jérôme Gardou
0933337404
[NTOS/MM] Do not dirtify section pages for system-space maps
...
Cc does it for itself.
2021-02-03 09:41:22 +01:00
Jérôme Gardou
d440434a8e
[NTOS/MM] Do not error when FS returns STATUS_END_OF_FILE for paged read.
...
Also remove a seemingly invalid ASSERT
2021-02-03 09:41:22 +01:00
Jérôme Gardou
b46173edaf
[NTOS/MM] DO not assert when being passed invalid parameters in MmCreateSection
2021-02-03 09:41:22 +01:00
Jérôme Gardou
ba49c39041
[NTOS/MM] Assert there are no RMAP left before freeing the page
2021-02-03 09:41:22 +01:00
Jérôme Gardou
d932bdb950
[NTOS:MM] Fix locking when paging out
2021-02-03 09:41:22 +01:00
Jérôme Gardou
d8cdb89fb0
[NTOSKRNL] Overhaul Cc and Mm relationship
...
Previously, when creating a file section, Mm requested Cc to cache the file, then Cc would request pages from Mm, then Mm would request them back to serve its file-mapping role
Now, Mm does it all by itself. If file cahcing is requested by the FS driver, then Cc creates a file mapping and uses that to serve its purpose.
This is a rewrite of Cc
2021-02-03 09:41:22 +01:00
Jérôme Gardou
e4047d1521
[NTOS/MM] Introduce MmArePagesResident and MmMakePagesResident
2021-02-03 09:41:22 +01:00
Jérôme Gardou
f1631b44e1
[NTOS/MM] Introduce MmMapViewInSystemSpaceEx
2021-02-03 09:41:22 +01:00
Jérôme Gardou
4f6fd6c42b
[NTOS/MM] Infer that the Memory Area is an image mapping from its VAD node
2021-02-03 09:41:21 +01:00
Jérôme Gardou
c3bd70cfd1
[NTOSKRNL/MM] Fix a few wine tests
2021-02-03 09:41:21 +01:00
Jérôme Gardou
4abda863ce
[NTOSKRNL/MM] Reduce use of MiIsRosSectionObject
2021-02-03 09:41:21 +01:00
Jérôme Gardou
b7d988ae5b
[NTOSKRNL] Get rid of MM_ROS_SECTION_OBJECT
2021-02-03 09:41:21 +01:00
Jérôme Gardou
8b98ff66ea
[NTOSKRNL] Store File Object in the segment instead of Section object
2021-02-03 09:41:21 +01:00
Jérôme Gardou
e980efebd4
[NTOSKRNL] Store the MM_IMAGE_SECTION_OBJECT pointer in SECTION::Segment
2021-02-03 09:41:21 +01:00
Jérôme Gardou
c6a87f28bf
[NTOSKRNL] Get rid of MEMORY_AREA::Protect
...
Use the VAD node instead
2021-02-03 09:41:21 +01:00
Jérôme Gardou
c9f924940a
[NTOSKRNL/MM] Get rid of useless members of MEMORY_AREA struct
2021-02-03 09:41:21 +01:00
Jérôme Gardou
defbf63416
[NTOSKRNL] Use PSECTION struct where possible
2021-02-03 09:41:21 +01:00
Jérôme Gardou
462d9a0974
[NTOSKRNL] Unload the cargo: We only use tiny bits of "NEWCC"
2021-02-03 09:41:21 +01:00
Jérôme Gardou
25722e647e
[NTOSKRNL] Embed a SECTION struct inside MM_ROS_SECTION_OBJECT
2021-02-03 09:41:21 +01:00
Jérôme Gardou
10ac04ff6e
[NTOSKRNL] Get rid of ROS_SECTION_OBJECT::AllocationAttributes in favor of MM_SECTION_FLAGS
2021-02-03 09:41:21 +01:00
Jérôme Gardou
819406ac97
[NTOSKRNL] Get rid of pagefile-backed sections support in legacy Mm
2021-02-03 09:41:21 +01:00
Jérôme Gardou
7afecee5eb
[NTOSKRNL] Rename MM_ROS_SECTION_OBJECT:SectionPageProtection to InitialPageProtection
2021-02-03 09:41:21 +01:00
Jérôme Gardou
54c760574b
[NTOSKRNL] Rename MM_ROS_SECTION_OBJECT:MaximumSize to SizeOfSection
...
For consistency with the SECTION struct
2021-02-03 09:41:21 +01:00
Jérôme Gardou
073ec9b0d4
[NTOSKRNL][NDK] Get rid of SECTION_OBJECT typedef
...
We will use the more recent SECTION (already used in ARM3) and this will avoid confusions
2021-02-03 09:41:21 +01:00
Jérôme Gardou
857dd4ae36
[NTOS:MM] Properly handle the 1-offset of paging files
2021-02-02 10:17:28 +01:00
Jérôme Gardou
f63401060d
[NTOS:MM] Fix compilation for amd64 port.
...
Addendum to 0919324772
2021-01-22 10:34:20 +01:00
Jérôme Gardou
0919324772
[NTOS:MM] Get rid of "compatibility layer" for hyper space mappings
...
Let's call that a bug layer instead.
2021-01-22 09:33:06 +01:00
Jérôme Gardou
57e8684bc6
[NTOS:MM] Allow "creating" a PDE in legacy Mm for foreign process
2021-01-22 09:32:36 +01:00
Jérôme Gardou
96ae15ac4b
[NTOS:MM] Fix more 64 bit arithmetics
2020-12-15 10:08:25 +01:00
Jérôme Gardou
abcbd44641
[NTOS:MM] Fix passing section size to MiCreatePagingFileMap & fix maximum size check
...
Also return the right status instead of stupidly asserting when failing to allocate memory.
2020-12-14 18:22:18 +01:00
Hervé Poussineau
c2946ced92
[NTOS:KD] Remove some now useless tests on _WINKD_
2020-11-16 08:55:03 +01:00
Timo Kreuzer
e67b62251f
[NTOS:MM] Handle PXE/PPE gaps in MiDeleteVirtualAddresses
2020-11-07 20:16:41 +01:00
Victor Perevertkin
5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
...
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Timo Kreuzer
d4b4cf7448
[NTOS:MM] Make sure PXEs/PPEs and PDEs are always MM_EXECUTE_READWRITE
...
This is required since the NX protection proagates from the highest level, enforcing NX on the entire range, independent of whether lower level P*Es have the bit set or not. It might be useful to add a platform specific constant to allow making page tables NX on architectures that have a different behavior.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
d55811f160
[NTOS:MM:X64] Fix session space initialization on x64
2020-11-01 09:32:27 +01:00
Timo Kreuzer
9095dbf5a5
[NTOS:MM:X64] Implement MmCreatePageFileMapping and MmDeletePageFileMapping
2020-11-01 09:32:27 +01:00
Timo Kreuzer
8980850d56
[NTOS:MM:X64] Simplify and fix x64 mapping code
...
- Use demand-zero-ptes in MiGetPteForProcess
- Handle NoExecute in MiSetPteProtection
- Fix MmIsPageSwapEntry
- Fix MmGetPageFileMapping
- remove obsolete functions.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
0726cfce10
[NTOS:MM:X64] Handle PPEs and PXEs as well in MmInitializeProcessAddressSpace()
...
But don't set up the PFNs for the initial process on x64, as these have already been set up.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
48d1bd2c88
[NTOS:MM:X64] On x64 allocate a VAD for the shared user page
2020-11-01 09:32:27 +01:00
Timo Kreuzer
a5d47ff72b
[NTOS:MM:X64] On x64 reserve the address range between FFFF800000000000 and FFFFF68000000000 in MiInitSystemMemoryAreas()
2020-11-01 09:32:27 +01:00
Timo Kreuzer
a8ba58fbb0
[NTOS:MM:X64] Improve x64 Mm initialization
...
* Move MiBuildPfnDatabaseFromPageTables into MiBuildPfnDatabase
* Make sure to call MmInitializeProcessAddressSpace() from the x64 version of MiInitMachineDependent()
* Handle result of MmInitializeProcessAddressSpace in MiInitMachineDependent (Should do the same for x86)
* Remove obsolete x64 debug print
2020-11-01 09:32:27 +01:00
Jérôme Gardou
15dd31377a
Revert "[NTOS/MM] Initialize process Working set and start implementing adding entries to it"
...
This reverts commit 5abc016401
.
Not ready for prime time
2020-10-20 15:56:53 +02:00
Jérôme Gardou
1c528cbf84
Revert "[NTOS/MM]
...
- Fix PFNs tracing
- Add private pages to the process working set"
This reverts commit 4c5351bf55
.
Not ready for prime time
2020-10-20 15:56:21 +02:00
Jérôme Gardou
4c5351bf55
[NTOS/MM]
...
- Fix PFNs tracing
- Add private pages to the process working set
2020-10-20 15:20:59 +02:00
Jérôme Gardou
5abc016401
[NTOS/MM] Initialize process Working set and start implementing adding entries to it
2020-10-20 15:20:59 +02:00
Thomas Faber
6b3f309a08
[NTOS] Consistently use MUTANT_INCREMENT.
...
Spotted by Hermès.
2020-10-16 16:09:54 +02:00
Thomas Faber
ba9bf73d48
[NTOS:MM] Acquire PsLoadedModuleResource when walking PsLoadedModuleList. CORE-16449
2020-10-15 14:49:20 +02:00
Thomas Faber
a30edc324e
[NTOS:MM] Acquire MmSystemLoadLock in MiFindInitializationCode. CORE-16449
...
We might otherwise free the INIT section for an image that's in the
process of being loaded by Mm.
2020-10-15 14:49:11 +02:00
Thomas Faber
ef1c726621
[NTOS:MM] Print debugging information in case CORE-16449 happens.
2020-10-08 08:59:46 +02:00
Thomas Faber
e57a59a60a
[NTOS:MM] Fail on SizeOfRawData overflow. CORE-17284
...
Fixes the corresponding tests in ntdll_apitest:NtMapViewOfSection.
Also add a TODO for the remaining test failures.
2020-10-03 13:20:25 +02:00
Thomas Faber
b957af4b6b
[NTOS:MM] VirtualSize overrides SizeOfRawData when mapping PE files. CORE-17284
...
This fixes the related failures in ntdll_apitest:NtMapViewOfSection
as well as loading of OrgPlayer's DragDrop.ocx.
2020-10-03 13:13:35 +02:00
Timo Kreuzer
3d17a7590d
[NTOS:MM] Fix paged pool initialization on x64
2020-10-01 11:24:42 +02:00
Victor Perevertkin
d01518da7c
[XDK] Add definitions required for newer storage class drivers (cdrom)
...
That introduced some warnings in the current code which were corrected as well
CORE-17129
2020-09-24 22:30:52 +03:00
Timo Kreuzer
896d090ee6
[NTOS:MM] Call MiSessionAddProcess() from MmCreateProcess() like on x86
2020-09-20 23:08:17 +02:00
Timo Kreuzer
bebcda0b0b
[NTOS:MM] In the x64 version of MmCreateProcessAddressSpace() zero out all page table PFNs
2020-09-20 23:08:17 +02:00
Serge Gautherie
a72b78558d
[NTOS:MM] MiGetPageTableForProcess(): #if out unreachable code
...
No impact.
Detected by Cppcheck: unreachableCode.
Addendum to ddaf47dec3
(r34976).
2020-06-25 21:59:02 +02:00
Serge Gautherie
ceccaae311
[NTOS:MM] MmDeleteProcessAddressSpace(): Move 'Address' to where it belongs ( #2865 )
...
No impact.
Detected by Cppcheck: unusedVariable.
Addendum to 2dade10d54
.
2020-06-01 12:10:11 +03:00
Serge Gautherie
b20f815126
[NTOSKRNL] Place INIT_FUNCTION before the return type ( #2823 )
...
(but after 'static' or SAL 2 annotation.)
Follow-up to 71fefa32
, which mentions that it's actually required by the compiler in some circumstances.
2020-05-23 15:56:10 +02:00
Hervé Poussineau
033102fdb1
[NTOS] Add a #define __ROS_ROSSYM__ when using rossym
...
Use it where needed.
2020-04-09 23:00:57 +02:00
Vadim Galyant
3c585d0e38
[NTOS:MM] Since the _MMPTE_SUBSECTION structure for x86 (without PAE) uses the SubsectionAddressLow truncated by the least significant three bits, the _CONTROL_AREA, _LARGE_CONTROL_AREA, _SUBSECTION, _MSUBSECTION structures must be 8-byte aligned.
...
Corresponding checks in MmArmInitSystem() have been removed.
2020-04-06 11:16:34 +02:00
Thomas Faber
5032a40d33
[NTOS:MM] In MmArmInitSystem, perform self-tests after per-arch initialization.
...
Mm(Non)PagedPoolStart won't be initialized otherwise, making the tests
pretty pointless.
2020-04-06 11:16:34 +02:00
Thomas Faber
74a2c6ba42
[NTOS:MM] Initialize MmSubsectionBase on x86 builds. CORE-16731
...
Spotted by Vadim Galyant.
2020-04-06 11:16:34 +02:00
Thomas Faber
25a5aee86f
[NTOS:MM] Get rid of unnecessary MmZeroingPageThreadActive.
2020-04-06 11:13:55 +02:00
Thomas Faber
5280deecfa
[NTOS:MM] Fix MmZeroingPageThreadActive race condition.
...
If a thread calls MiInsertPageInFreeList after the zero page thread has
woken up from its wait but before it acquired the PFN lock,
MmZeroingPageEvent might get set again even though there is no additional
work to be done.
By setting MmZeroingPageThreadActive together with the event, the variable
correctly indicates for future callers that the zero thread will process
newly added free pages.
This partially reverts r72990.
2020-04-06 11:13:55 +02:00
Vadim Galyant
ac843d7b82
[NTOS:MM] Make the definitions and macros for x86 more human-readable. ( #2487 )
...
- Move also PDE_MAPPED_VA definition from common miarm.h to ..arch/mm.h.
- Add assert "PAE not yet implemented".
2020-04-04 14:26:15 +02:00
Vadim Galyant
b78cb36d91
[NTOS:MM] Using the macro MiIsPteOnPdeBoundary(). ( #2496 )
...
The SYSTEM_PD_SIZE constant should not be used to determine the page boundary for page tables. It is better to use the portable MiIsPteOnPdeBoundary() macro for this.
2020-04-02 12:15:33 +02:00
Thomas Faber
6831468ccf
[NTOS:MM] Assert PFN lock ownership in MiInsertPageInFreeList.
...
AMD64 initialization previously only raised the IRQL.
It now acquires the lock where needed, as i386 does.
2020-03-02 20:50:54 +01:00
Thomas Faber
754e175d12
[NTOS:MM] Use MI_ZERO_PTES as the number of usable zeroing PTEs, not the total allocated. CORE-11856
...
We'll now have 32 usable zeroing PTEs instead of 31.
MP kernels will (some day) zero up to 32 pages at a time.
2020-02-22 12:33:54 +01:00
Thomas Faber
feb7275bc8
[NTOS:MM] Use POOL_BILLED_PROCESS_INVALID constant.
2020-02-08 13:00:32 +01:00
Serge Gautherie
2c6747aff0
[NTOS:MM] Stop using PD_COUNT, PDE_COUNT and PTE_COUNT ( #2294 )
...
Directly use PPE_PER_PAGE, PDE_PER_PAGE, PTE_PER_PAGE constants from hardware-specific MM headers instead
2020-02-05 23:48:26 +01:00
Timo Kreuzer
7523a7b138
[NTOS:KE] Rename some locking functions to reflect the IRQL level changes
...
* KiAcquireApcLock -> KiAcquireApcLockRaiseToSynch
* KiAcquireApcLockAtDpcLevel -> KiAcquireApcLockAtSynchLevel
* KiReleaseApcLockFromDpcLevel -> KiReleaseApcLockFromSynchLevel
* KiAcquireApcLockAtApcLevel -> KiAcquireApcLockRaiseToDpc
* KiAcquireProcessLock -> KiAcquireProcessLockRaiseToSynch
* KiReleaseProcessLockFromDpcLevel -> KiReleaseProcessLockFromSynchLevel
* KiAcquireDispatcherLockAtDpcLevel -> KiAcquireDispatcherLockAtSynchLevel
* KiReleaseDispatcherLockFromDpcLevel -> KiReleaseDispatcherLockFromSynchLevel
* Add some ASSERTs
2019-12-31 15:30:27 +01:00
Timo Kreuzer
21647e2c4e
[NTOS] Revert pool debugging code
...
Revert "[NTOS] On DBG builds, fill pool allocations with 0xCD and freed pool with 0xDD"
This reverts commit 24f240be8a
.
Revert "[NTOS] Add compile time option to trace callers of pool allocations"
This reverts commit 8b20755040
.
Revert "WIP"
This reverts commit 8cfd5c601f
.
2019-11-25 19:32:06 +01:00
Timo Kreuzer
8cfd5c601f
WIP
2019-11-24 18:26:19 +01:00
Timo Kreuzer
8b20755040
[NTOS] Add compile time option to trace callers of pool allocations
2019-11-24 18:26:19 +01:00
Timo Kreuzer
24f240be8a
[NTOS] On DBG builds, fill pool allocations with 0xCD and freed pool with 0xDD
...
This matches what the MSVC runtime does with heap allocations on debug builds.
2019-11-24 18:26:19 +01:00
Hermès Bélusca-Maïto
ea6d427d10
[I8042PRT] Remove dead commented-out code; Allow sending ROS-specific commands to the kernel debugger since KD64 also support them.
...
[NTOS:MM] Remove an extra ')' in a DbgPrint() string.
2019-11-17 23:21:55 +01:00
Hermès Bélusca-Maïto
7e941247bd
[MM:AMD64] Remove the _WINKD_ around MmDebugPte since it's now used by both kd64 (windbg) and KDBG through the usage of mmdbg.c
2019-11-03 23:46:54 +01:00
Hermès Bélusca-Maïto
f5e86c0fd3
[NTOS] Just go ahead and allow printing all the printable ASCII characters in ExpTagAllowPrint().
...
As documented in https://docs.microsoft.com/fr-fr/windows-hardware/drivers/ddi/wdm/nf-wdm-exallocatepoolwithtag
pool tag "characters" must be a value in the range 0x20 (space) to 0x7E (tilde),
which happen indeed to be the range of printable (non-extended) ASCII characters.
(The display problem was originally caught while attempting to display
the pool tag 0x3a306847 corresponding to 'Gh0:', a win32ss GDIOBJ pool tag
encoded with macro GDIOBJ_POOL_TAG().)
2019-11-01 19:09:29 +01:00
Stanislav Motylkov
9bf672d4f1
[NTOS:MM] Add debug print to MiAllocateContiguousMemory in out-of-memory case
2019-10-27 06:32:50 +01:00
Timo Kreuzer
56da95671c
[NTOS] Fix a bug in the PE loader, which caused images to be loaded up to MmHighestUserAddress, thus overwriting the shared user page.
...
This is now fixed by using MM_HIGHEST_VAD_ADDRESS as the margin instead.
Should fix CORE-11717
2019-10-26 21:38:13 +02:00
Pierre Schweitzer
3b78ca210e
[NTOSKRNL] Simplify buffer definition in MiQueryMemorySectionName().
...
Also take into account the UNICODE_STRING structure while computing whole size
This is based on Thomas' patch.
CORE-12043
2019-09-29 14:16:44 +02:00
Timo Kreuzer
41250d1028
[NTOS:MM] Fix MmspCompareSegments
...
On x64 the previous implementation would only compare the upper 32 bits and ignore the lower 32 bits.
2019-09-01 14:15:07 +02:00
Serge Gautherie
66bf74d228
[NTOSKRNL] Move DPRINT1("Thread wants too much stack\n") around
...
To KiUserModeCallout() from MmGrowKernelStackEx().
As suggested by Thomas Faber:
"MmGrowKernelStackEx really shouldn't be DPRINT'ing."
CORE-14494
2019-08-15 18:18:59 +02:00
Timo Kreuzer
de679e8f33
[NTOS:MM] MmSizeOfSystemCacheInPages is ULONG_PTR, not ULONG
...
Fixes failed assertion on x64.
2019-08-15 18:04:57 +02:00
Timo Kreuzer
7611cc2b12
[REACTOS] Fix SIZE_T related warnings
2019-08-15 14:20:00 +02:00
Hermès Bélusca-Maïto
3625238ecb
[NTOS:MM] Add a MmChangeKernelResourceSectionProtection() helper. ( #1649 )
...
This allows setting the memory protection of the kernel's resource
section as will. MmMakeKernelResourceSectionWritable() is re-implemented
around this helper.
2019-07-14 22:23:49 +02:00
Serge Gautherie
ccf8bff3ec
[NTOS:MM] Fix MmGetFileNameForAddress() callers. ( #1723 )
...
MmGetFileNameForAddress() calls RtlCreateUnicodeString().
This also fixes a leak in MiQueryMemorySectionName().
2019-07-14 00:32:23 +02:00
Serge Gautherie
6ba611f39e
[NTOS:MM] Fix MmSizeOfSystemCacheInPages value on AMD64
...
And add 'ASSERT(MmSystemCacheEnd == ...);'.
Addendum to d56a249089
.
CORE-14259
2019-07-06 09:55:38 +02:00
Hermès Bélusca-Maïto
05616105a5
[NTOS:MM] Fix MiLocateKernelSections() and MmMakeKernelResourceSectionWritable().
...
- MiLocateKernelSections(): Fix the calculation of MiKernelResourceEndPte,
MmPoolCodeEnd and MmPteCodeEnd.
- MmMakeKernelResourceSectionWritable(): Fix PTE looping upper limit;
use MI_MAKE_HARDWARE_PTE_KERNEL to build the updated read-write PTE.
2019-06-26 00:57:53 +02:00
Hermès Bélusca-Maïto
f694d12f0c
[NTOS:KE/MM] Some bug-fixes in the bugcheck code.
...
- Introduce the MmMakeKernelResourceSectionWritable() helper for
making the kernel resource memory section writable, and use it
in KeGetBugMessageText(). Indeed, this latter function patches
in place the bugcheck resource message to trim any trailing
newlines before displaying the message on screen.
See also https://github.com/osresearch/uxen/blob/83bad53/dm/introspection-win7.c#L286
that mentions it too.
This fixes bugcheck text display (e.g. the MANUALLY_INITIATED_CRASH one)
when using (at least) MSVC-built ReactOS, avoiding a Page-Fault
exception during the bugcheck.
- Cover KeGetBugMessageText() in SEH since we are accessing kernel
resources that could also be corrupted in bugcheck scenarii, and we
don't want to further bugcheck.
- Fix newline trimming loop.
- KiDoBugCheckCallbacks():
* Wrap the bugcheck CallbackRoutine call in SEH.
* Add a FIXME concerning the need of further memory validation of CurrentRecord.
- Add a FIXME concerning the need to run the bugcheck-reason callbacks
with the KbCallbackReserved1 reason, in KeBugCheckWithTf().
Mentioned in http://blog.ptsecurity.com/2012/06/customizing-blue-screen-of-death.html
2019-06-25 21:01:49 +02:00
Serge Gautherie
cf27695269
[NTOS:MM] PeFmtCreateSection(): Improve AMD64 image failure case
...
Addendum to 98638cc2df
.
CORE-15981
2019-06-04 18:22:19 +02:00
Mark Jansen
98638cc2df
[NTOS/MM] Recognize AMD64 image in PeFmtCreateSection failure case
2019-05-15 19:39:56 +02:00
Thomas Faber
f3a280f52b
[NTOS] Use correct buffer size when calling MiResolveImageReferences. CORE-15882
2019-05-05 10:39:11 +02:00
Mark Jansen
2450dec427
[NTOS/MM] Ensure ImageBase is not used uninitialized
2019-04-30 18:57:43 +02:00
Bernhard Feichtinger
f5471b7b4b
[NTOS][USERSRV] Silence noisy debug output.
2019-04-22 17:41:17 +02:00
Maxim Smirnov
d29e216f99
[NTOSKRNL] In MmCreateImageSection, properly check whether cache was initialized
...
This fixes a crash that occurs if nul is typed in cmd.exe
2019-03-31 13:51:06 +02:00
Timo Kreuzer
81727760e4
[NTOS::Mm] Fix inverted check in MiWriteProtectSystemImage
2019-02-24 20:34:02 +01:00
Serge Gautherie
84e76b1c4c
[NTOS:MM] ExFreePoolWithTag(): Accept tag mismatch, on release build only ( #1334 )
...
"Release" builds should not BSoD on 'Freeing pool - invalid tag specified' case,
this is compatible with Windows behaviour.
Nothing changes otherwise concerning the "Debug" builds, where pool-tag mismatch
triggers a BSoD as expected.
CORE-15446
2019-02-07 16:57:56 +01:00
Thomas Faber
066ee4db3b
[NTOS:MM] Dump pool consumers at most once per second.
...
This should avoid some log spam during kmtest:ExPools, which
intentionally depletes pool.
2019-02-03 12:54:36 +01:00
Pierre Schweitzer
a6dc1d69bc
[NTOS:MM] On big pool enumeration, return entry instead of base VA
2019-02-02 10:45:15 +01:00
Hermès Bélusca-Maïto
06d4fce5ee
[NTOS:MM] Some fixes for NtCreatePagingFile().
...
- Correctly probe the FileName user pointer before capturing its contents.
- A paging file name with zero length is invalid too.
- Remember (TODO!) in the code that the lower bounds of the Safe*Size values
need to be checked too!
2019-01-28 22:22:56 +01:00
Timo Kreuzer
3410b25fde
[NTOS] Turn broken assert into DPRINT
2019-01-19 13:38:24 +01:00
Timo Kreuzer
65dbfc2868
[NTOS:Mm] Rewrite MiWriteProtectSystemImage ( #749 )
...
* The previous version was overcomplicated and broken and therefore disabled.
* The new version also enforces NX protection on x64.
* Now that protecting works, also protect the boot loaded images.
2019-01-18 22:11:43 +01:00
Pierre Schweitzer
d9a3fd16d4
[NTOSKRNL] Add support for callback when enumerating large pool allocations
2019-01-15 22:07:35 +01:00
Thomas Faber
e7de564bfc
[NTOS:MM] Implement big pool table expansion. CORE-15051
2019-01-09 08:18:38 +01:00
Pierre Schweitzer
a3f8813fff
[NTOSKRNL] Add support for large allocations in !poolfind
2019-01-08 08:43:23 +01:00
Pierre Schweitzer
e1342127f0
[NTOSKRNL] In !irpfind, add info about current stack major/minor
2019-01-08 08:43:23 +01:00