mirror of
https://github.com/reactos/reactos.git
synced 2024-06-24 06:51:47 +00:00
[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 svn path=/trunk/; revision=74391
This commit is contained in:
parent
6e74416198
commit
1f03a83d50
|
@ -3661,23 +3661,6 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -3700,6 +3683,27 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
|
|||
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 */
|
||||
Status = MmMapViewOfSection(Section,
|
||||
Process,
|
||||
|
|
Loading…
Reference in a new issue