reactos/ntoskrnl/ke
diff -u -r1.51 -r1.52
--- kthread.c 21 Aug 2004 21:09:39 -0000 1.51
+++ kthread.c 27 Aug 2004 10:24:04 -0000 1.52
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: kthread.c,v 1.51 2004/08/21 21:09:39 tamlin Exp $
+/* $Id: kthread.c,v 1.52 2004/08/27 10:24:04 hbirr Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Microkernel thread support
@@ -188,8 +188,16 @@
Thread->StackLimit = (ULONG)&init_stack;
Thread->KernelStack = (PVOID)&init_stack_top;
}
+
+ /*
+ * Establish the pde's for the new stack and the thread structure within the
+ * address space of the new process. They are accessed while taskswitching or
+ * while handling page faults. At this point it isn't possible to call the
+ * page fault handler for the missing pde's.
+ */
MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, MM_STACK_SIZE);
+ MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
/*
* The Native API function will initialize the TEB field later
reactos/ntoskrnl/ke
diff -u -r1.25 -r1.26
--- process.c 21 Aug 2004 21:19:06 -0000 1.25
+++ process.c 27 Aug 2004 10:24:04 -0000 1.26
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: process.c,v 1.25 2004/08/21 21:19:06 tamlin Exp $
+/* $Id: process.c,v 1.26 2004/08/27 10:24:04 hbirr Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/process.c
@@ -55,16 +55,17 @@
KEBUGCHECK(INVALID_PROCESS_ATTACH_ATTEMPT);
}
- /* The stack of the current process may be located in a page which is
- not present in the page directory of the process we're attaching to.
- That would lead to a page fault when this function returns. However,
- since the processor can't call the page fault handler 'cause it can't
- push EIP on the stack, this will show up as a stack fault which will
- crash the entire system.
+ /* The stack and the thread structure of the current process may be
+ located in a page which is not present in the page directory of
+ the process we're attaching to. That would lead to a page fault
+ when this function returns. However, since the processor can't
+ call the page fault handler 'cause it can't push EIP on the stack,
+ this will show up as a stack fault which will crash the entire system.
To prevent this, make sure the page directory of the process we're
attaching to is up-to-date. */
MmUpdatePageDir(Process, (PVOID)CurrentThread->Tcb.StackLimit, MM_STACK_SIZE);
+ MmUpdatePageDir(Process, (PVOID)CurrentThread, sizeof(ETHREAD));
KeRaiseIrql(DISPATCH_LEVEL, &oldlvl);