Author: sginsberg
Date: Wed Aug 13 12:00:49 2008
New Revision: 35308
URL: http://svn.reactos.org/svn/reactos?rev=35308&view=rev
Log:
- "Sync" to the next thread's initial stack in KiSwapThread. This fixes an invalid page fault (faulting while interrupts are disabled) during context switching, where we access the next thread's initial stack before performing the address space switch. Many thanks to Alex for his help with this bug!
- Fix stack size calculations in KeAttachProcess and KeStackAttachProcess (thanks to Alex for pointing this out)
Modified:
trunk/reactos/ntoskrnl/ke/procobj.c
trunk/reactos/ntoskrnl/ke/thrdschd.c
Modified: trunk/reactos/ntoskrnl/ke/procobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/procobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] Wed Aug 13 12:00:49 2008
@@ -451,7 +451,7 @@
MiSyncThreadProcessViews(Process,
(PVOID)Thread->StackLimit,
Thread->LargeStack ?
- KERNEL_STACK_SIZE : KERNEL_LARGE_STACK_SIZE);
+ KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
MiSyncThreadProcessViews(Process, Thread, sizeof(ETHREAD));
/* Check if we're already in that process */
@@ -581,7 +581,7 @@
MiSyncThreadProcessViews(Process,
(PVOID)Thread->StackLimit,
Thread->LargeStack ?
- KERNEL_STACK_SIZE : KERNEL_LARGE_STACK_SIZE);
+ KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
MiSyncThreadProcessViews(Process, Thread, sizeof(ETHREAD));
/* Crash system if DPC is being executed! */
Modified: trunk/reactos/ntoskrnl/ke/thrdschd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdschd.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] Wed Aug 13 12:00:49 2008
@@ -347,6 +347,10 @@
MiSyncThreadProcessViews(PsGetCurrentProcess(),
((PETHREAD)NextThread)->ThreadsProcess,
sizeof(EPROCESS));
+ MiSyncThreadProcessViews(PsGetCurrentProcess(),
+ (PVOID)((PETHREAD)NextThread)->Tcb.StackLimit,
+ NextThread->LargeStack ?
+ KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
/* Swap contexts */
ApcState = KiSwapContext(CurrentThread, NextThread);
Author: cgutman
Date: Wed Aug 13 09:53:22 2008
New Revision: 35306
URL: http://svn.reactos.org/svn/reactos?rev=35306&view=rev
Log:
- Set Buf to NULL so we don't try to free it again later
Modified:
branches/aicom-network-fixes/drivers/network/afd/afd/lock.c
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/lock.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/lock.c [iso-8859-1] Wed Aug 13 09:53:22 2008
@@ -123,6 +123,7 @@
}
ExFreePool( Buf );
+ Buf = NULL;
}
/* Produce a kernel-land handle array with handles replaced by object
Author: sginsberg
Date: Wed Aug 13 04:00:50 2008
New Revision: 35302
URL: http://svn.reactos.org/svn/reactos?rev=35302&view=rev
Log:
- Fix a broken check in PspExitThread. We should check if Stack Swapping is _disabled_ during termination, not crash if it is enabled!
- Fix KeInitThread to respect this, and initialize EnableStackSwap to TRUE. Otherwise, only executive worker threads who modify the stack swap flag themselves encounter this issue.
- This, along with my previous change, fixes worker thread termination being completely broken and crashing ros.
- Thanks to Aleksey for confirming my changes
Modified:
trunk/reactos/ntoskrnl/ke/thrdobj.c
trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] Wed Aug 13 04:00:50 2008
@@ -742,7 +742,7 @@
}
/* Set swap settings */
- Thread->EnableStackSwap = FALSE;//TRUE;
+ Thread->EnableStackSwap = TRUE;
Thread->IdealProcessor = 1;
Thread->SwapBusy = FALSE;
Thread->KernelStackResident = TRUE;
Modified: trunk/reactos/ntoskrnl/ps/kill.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/kill.c?rev=353…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] Wed Aug 13 04:00:50 2008
@@ -697,10 +697,10 @@
PspW32ProcessCallout(CurrentProcess, FALSE);
}
- /* Make sure Stack Swap isn't enabled */
- if (Thread->Tcb.EnableStackSwap)
- {
- /* Stack swap really shouldn't be on during exit !*/
+ /* Make sure Stack Swap is enabled */
+ if (!Thread->Tcb.EnableStackSwap)
+ {
+ /* Stack swap really shouldn't be disabled during exit! */
KEBUGCHECKEX(KERNEL_STACK_LOCKED_AT_EXIT, 0, 0, 0, 0);
}
Author: sginsberg
Date: Wed Aug 13 02:55:59 2008
New Revision: 35299
URL: http://svn.reactos.org/svn/reactos?rev=35299&view=rev
Log:
- Reapply the PsTerminateSystemThread typo fix. We do boot fine with this fix.
- Note to self: Don't commit after midnight and always test your patches yourself
Modified:
trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/kill.c?rev=352…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] Wed Aug 13 02:55:59 2008
@@ -1086,7 +1086,7 @@
PETHREAD Thread = PsGetCurrentThread();
/* Make sure this is a system thread */
- if (Thread->SystemThread) return STATUS_INVALID_PARAMETER;
+ if (!Thread->SystemThread) return STATUS_INVALID_PARAMETER;
/* Terminate it for real */
return PspTerminateThreadByPointer(Thread, ExitStatus, TRUE);