reactos/ntoskrnl/mm
Timo Kreuzer d5181e44dd
[NTOS] Fix MiFindInitializationCode (#751)
Short: The code was suffering from an off-by-one bug (inconsistency between inclusive end exclusive end address), which could lead to freeing one page above the initialization code. This led to freeing part of the kernel import section on x64. Now it is consistently using the aligned/exclusive end address.

Long:
* Initialization sections are freed both for the boot loaded images as well as for drivers that are loaded later. Obviously the second mechanism needs to be able to run at any time, so it is not initialization code itself. For some reason someone decided though, it would be a smart idea to implement the code twice, once for the boot loaded images, once for drivers and concluding that the former was initialization code itself and had to be freed.
* Since freeing the code that frees the initialization sections, while it is doing that is not possible, it uses a "smart trick", initially skipping that range, returning its start and end to the caller and have the caller free it afterwards.
* The code was using the end address in an inconsistent way, partly aligning it to the start of the following section, sometimes pointing to the last byte that should be freed. The function that freed each chunk was assuming the latter (i.e. that the end was included in the range) and thus freed the page that contained the end address. The end address for the range that was returned to the caller was aligned to the start of the next section, and the caller used it to free the range including the following page. On x64 this was the start of the import section of ntoskrnl. How that worked on x86 I don't even want to know.
2018-08-21 10:35:57 +02:00
..
amd64 Amd64/misc 64bit fixes (#236) 2018-01-01 12:07:50 +01:00
arm
ARM3 [NTOS] Fix MiFindInitializationCode (#751) 2018-08-21 10:35:57 +02:00
i386 [NTOS:MM] Improve debug prints in MmCreateVirtualMappingUnsafe. CORE-14478 2018-03-18 23:49:48 +01:00
powerpc
balance.c [NTOS:MM] Use inline functions to acquire/release the PFN lock. 2017-12-08 10:32:08 +01:00
freelist.c [NTOS:MM] Use inline functions to acquire/release the PFN lock. 2017-12-08 10:32:08 +01:00
marea.c [NTOS:MM] Update a DPRINT string (#760) 2018-08-16 15:10:24 +02:00
mmfault.c [NTOS:MM] Pass The FaultCode to MmArmAcceessFault as well and translate it there to what was declared as "StoreInstruction" 2018-01-06 18:20:24 +01:00
mminit.c [NTOSKRNL] Define the Mm global variables related to Cc on Mm init. 2018-02-06 13:41:23 +01:00
pagefile.c [NTOSKRNL] Only allow page file on a few specific device types 2018-08-16 19:00:22 +02:00
region.c
rmap.c
section.c [NTOSKRNL] Ignore IMAGE_SCN_CNT_UNINITIALIZED_DATA 2018-06-03 20:40:51 +02:00
shutdown.c [NTOSKRNL] Keep page file name along the page file and free it on shutdown 2018-08-13 08:30:17 +02:00