Browse Source

Fix bug causing page tables not to get created.

The stack image section spans two page directories, but usually only
touches the last page or so. On fork, page tables are created but not set
to present in the child process. With the new Min/MaxTouched variables in
image sections, MmpCopyAndChangeSectionMappings is called for only that
small sliver at the end, so the other page tables in the stack section
never get set to present. Then, if that new child forks,
MmpPreallocatePageTables will skip over those page tables, since it looks
only at the present bit of the PDE, not the Entry.

Make preallocate observe the entry rather than the present bit, so
non-present but still necessary page tables are also copied. The existing
code already watches out for needing to zero a page table that exists but
is uninitialized.
Evan Green 8 years ago
parent
commit
0738c3abc3
2 changed files with 2 additions and 2 deletions
  1. 1 1
      kernel/mm/armv7/mapping.c
  2. 1 1
      kernel/mm/x86/mapping.c

+ 1 - 1
kernel/mm/armv7/mapping.c

@@ -2533,7 +2533,7 @@ Return Value:
     Destination = DestinationSpace->PageDirectory;
     Source = SourceSpace->PageDirectory;
     for (Index = 0; Index < FLT_INDEX(KERNEL_VA_START); Index += 4) {
-        if (Source[Index].Format != FLT_COARSE_PAGE_TABLE) {
+        if (Source[Index].Entry == 0) {
             continue;
         }
 

+ 1 - 1
kernel/mm/x86/mapping.c

@@ -2063,7 +2063,7 @@ Return Value:
          DirectoryIndex < ((UINTN)KERNEL_VA_START >> PAGE_DIRECTORY_SHIFT);
          DirectoryIndex += 1) {
 
-        if (Source[DirectoryIndex].Present == 0) {
+        if (Source[DirectoryIndex].Entry == 0) {
             continue;
         }