mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 12:33:31 +08:00
d5181e44dd
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. |
||
---|---|---|
.. | ||
arm | ||
i386 | ||
contmem.c | ||
drvmgmt.c | ||
dynamic.c | ||
expool.c | ||
hypermap.c | ||
iosup.c | ||
largepag.c | ||
mdlsup.c | ||
miarm.h | ||
miavl.h | ||
mmdbg.c | ||
mminit.c | ||
mmsup.c | ||
ncache.c | ||
pagfault.c | ||
pfnlist.c | ||
pool.c | ||
procsup.c | ||
section.c | ||
session.c | ||
special.c | ||
sysldr.c | ||
syspte.c | ||
vadnode.c | ||
virtual.c | ||
zeropage.c |