Author: arty
Date: Fri Nov 20 21:31:09 2009
New Revision: 44244

URL: http://svn.reactos.org/svn/reactos?rev=44244&view=rev
Log:
Make sure to try to map sections only in the address space we live in.

Modified:
    branches/arty-newcc/ntoskrnl/mm/section/data.c
    branches/arty-newcc/ntoskrnl/mm/section/image.c

Modified: branches/arty-newcc/ntoskrnl/mm/section/data.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/data.c?rev=44244&r1=44243&r2=44244&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] Fri Nov 20 
21:31:09 2009
@@ -829,7 +829,7 @@
        End.LowPart = PAGE_ROUND_DOWN(End.LowPart);
        FileOffset.LowPart = PAGE_ROUND_UP(FileOffset.LowPart);
        FirstMapped.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart;
-       DPRINT1
+       DPRINT
                ("Pulling zero pages for %08x%08x-%08x%08x\n",
                 FileOffset.u.HighPart, FileOffset.u.LowPart,
                 End.u.HighPart, End.u.LowPart);
@@ -2878,9 +2878,7 @@
 
    if (Section->AllocationAttributes & SEC_IMAGE)
    {
-          DPRINT1("Mapping as image: %wZ\n", &Section->FileObject->FileName);
           Status = MiMapImageFileSection(AddressSpace, Section, BaseAddress);
-          DPRINT1("Mapping %x\n", Status);
    }
    else
    {
@@ -2938,7 +2936,6 @@
       }
 
       MmLockSectionSegment(Section->Segment);
-         DPRINT1("Mapping as data\n");
       Status = MiMapViewOfSegment(AddressSpace,
                                   Section,
                                   Section->Segment,
@@ -2947,13 +2944,10 @@
                                   Protect,
                                   &ViewOffset,
                                   AllocationType & 
(MEM_TOP_DOWN|SEC_NO_CHANGE));
-         DPRINT1("Status %x\n", Status);
       MmUnlockSectionSegment(Section->Segment);
    }
 
-   DPRINT1("Unlock address space\n");
    MmUnlockAddressSpace(AddressSpace);
-   DPRINT1("Done\n");
    return(Status);
 }
 

Modified: branches/arty-newcc/ntoskrnl/mm/section/image.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/image.c?rev=44244&r1=44243&r2=44244&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] Fri Nov 20 
21:31:09 2009
@@ -1689,7 +1689,9 @@
        ImageSectionObject->ImageSize = ImageSize;
        
        /* Check there is enough space to map the section at that point. */
-       if (MmLocateMemoryAreaByRegion(AddressSpace, (PVOID)ImageBase,
+       if ((AddressSpace != MmGetKernelAddressSpace() &&
+                (ULONG_PTR)ImageBase >= (ULONG_PTR)MM_HIGHEST_USER_ADDRESS) ||
+               MmLocateMemoryAreaByRegion(AddressSpace, (PVOID)ImageBase,
                                                                   
PAGE_ROUND_UP(ImageSize)) != NULL)
        {
                /* Fail if the user requested a fixed base address. */


Reply via email to