Author: tfaber
Date: Sun Apr 23 09:38:45 2017
New Revision: 74391
URL:
http://svn.reactos.org/svn/reactos?rev=74391&view=rev
Log:
[NTOS:MM]
- In NtMapViewOfSection, check for address alignment after validating the handles. This
fixes the tests from the previous commit, but is also necessary because information about
the section object is necessary to avoid the alignment checks for physical memory
sections.
CORE-13113
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/section.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Sun Apr 23 09:38:45 2017
@@ -3661,23 +3661,6 @@
}
}
- if (!(AllocationType & MEM_DOS_LIM))
- {
- /* Check for non-allocation-granularity-aligned BaseAddress */
- if (SafeBaseAddress != ALIGN_DOWN_POINTER_BY(SafeBaseAddress,
MM_VIRTMEM_GRANULARITY))
- {
- DPRINT("BaseAddress is not at 64-kilobyte address boundary.");
- return STATUS_MAPPED_ALIGNMENT;
- }
-
- /* Do the same for the section offset */
- if (SafeSectionOffset.LowPart != ALIGN_DOWN_BY(SafeSectionOffset.LowPart,
MM_VIRTMEM_GRANULARITY))
- {
- DPRINT("SectionOffset is not at 64-kilobyte address boundary.");
- return STATUS_MAPPED_ALIGNMENT;
- }
- }
-
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_VM_OPERATION,
@@ -3698,6 +3681,27 @@
{
ObDereferenceObject(Process);
return Status;
+ }
+
+ if (!(AllocationType & MEM_DOS_LIM))
+ {
+ /* Check for non-allocation-granularity-aligned BaseAddress */
+ if (SafeBaseAddress != ALIGN_DOWN_POINTER_BY(SafeBaseAddress,
MM_VIRTMEM_GRANULARITY))
+ {
+ DPRINT("BaseAddress is not at 64-kilobyte address boundary.");
+ ObDereferenceObject(Section);
+ ObDereferenceObject(Process);
+ return STATUS_MAPPED_ALIGNMENT;
+ }
+
+ /* Do the same for the section offset */
+ if (SafeSectionOffset.LowPart != ALIGN_DOWN_BY(SafeSectionOffset.LowPart,
MM_VIRTMEM_GRANULARITY))
+ {
+ DPRINT("SectionOffset is not at 64-kilobyte address boundary.");
+ ObDereferenceObject(Section);
+ ObDereferenceObject(Process);
+ return STATUS_MAPPED_ALIGNMENT;
+ }
}
/* Now do the actual mapping */