[ros-dev] [ros-diffs] [arty] 32007: Fix termination of process under debug.
Alex Ionescu
ionucu at videotron.ca
Sat Jan 26 16:39:41 CET 2008
This is incorrect behavior, the terminate should be instant. This will
likely cause bugs in the user-mode debugging framework.
On 26-Jan-08, at 4:20 AM, arty at svn.reactos.org wrote:
> Author: arty
> Date: Sat Jan 26 12:20:56 2008
> New Revision: 32007
>
> URL: http://svn.reactos.org/svn/reactos?rev=32007&view=rev
> Log:
> Fix termination of process under debug.
>
> Modified:
> trunk/reactos/ntoskrnl/dbgk/dbgkobj.c
>
> Modified: trunk/reactos/ntoskrnl/dbgk/dbgkobj.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/dbgkobj.c?rev=32007&r1=32006&r2=32007&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/reactos/ntoskrnl/dbgk/dbgkobj.c (original)
> +++ trunk/reactos/ntoskrnl/dbgk/dbgkobj.c Sat Jan 26 12:20:56 2008
> @@ -1065,6 +1065,17 @@
>
> VOID
> NTAPI
> +DbgkpDelayedTerminateProcess(PVOID Arg)
> +{
> + PWORK_QUEUE_ITEM WorkItem = (PWORK_QUEUE_ITEM)Arg;
> + PEPROCESS OwnerProcess = *((PEPROCESS *)&WorkItem[1]);
> + ExFreePool(WorkItem);
> + /* Terminate the process */
> + PsTerminateProcess(OwnerProcess, STATUS_DEBUGGER_INACTIVE);
> +}
> +
> +VOID
> +NTAPI
> DbgkpCloseObject(IN PEPROCESS OwnerProcess OPTIONAL,
> IN PVOID ObjectBody,
> IN ACCESS_MASK GrantedAccess,
> @@ -1079,6 +1090,8 @@
> DBGKTRACE(DBGK_OBJECT_DEBUG, "OwnerProcess: %p DebugObject: %p\n",
> OwnerProcess, DebugObject);
>
> + DPRINT("APC DISABLE: %d\n", ((PETHREAD)KeGetCurrentThread())-
> >Tcb.CombinedApcDisable);
> +
> /* If this isn't the last handle, do nothing */
> if (SystemHandleCount > 1) return;
>
> @@ -1127,8 +1140,16 @@
> /* Check if we terminate on exit */
> if (DebugObject->KillProcessOnExit)
> {
> - /* Terminate the process */
> - PsTerminateProcess(OwnerProcess,
> STATUS_DEBUGGER_INACTIVE);
> + PWORK_QUEUE_ITEM WorkItem =
> + ExAllocatePool
> + (NonPagedPool,
> + sizeof(WORK_QUEUE_ITEM) + sizeof(PVOID));
> + ExInitializeWorkItem
> + (WorkItem,
> + DbgkpDelayedTerminateProcess,
> + WorkItem);
> + *((PEPROCESS *)&WorkItem[1]) = OwnerProcess;
> + ExQueueWorkItem(WorkItem, CriticalWorkQueue);
> }
>
> /* Dereference the debug object */
>
>
Best regards,
Alex Ionescu
More information about the Ros-dev
mailing list