[ros-diffs] [sginsberg] 37102: - NtWrite/ReadFile: Don't hardcode Irp->RequestorMode to KernelMode! Instead, use the PreviousMode we saved earlier. This caused user mode APCs to be called from kernel mode, which is a...very...bad... idea. - Spotted by bug 3607 and exposed by ntdll Winetests "file" See issue #3607 for more details.

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Thu Oct 30 16:59:00 CET 2008


Author: sginsberg
Date: Thu Oct 30 10:59:00 2008
New Revision: 37102

URL: http://svn.reactos.org/svn/reactos?rev=37102&view=rev
Log:
- NtWrite/ReadFile: Don't hardcode Irp->RequestorMode to KernelMode! Instead, use the PreviousMode we saved earlier. This caused user mode APCs to be called from kernel mode, which is a...very...bad... idea.
- Spotted by bug 3607 and exposed by ntdll Winetests "file"
See issue #3607 for more details.

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/iofunc.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c?rev=37102&r1=37101&r2=37102&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] Thu Oct 30 10:59:00 2008
@@ -2070,7 +2070,7 @@
     /* Set the IRP */
     Irp->Tail.Overlay.OriginalFileObject = FileObject;
     Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-    Irp->RequestorMode = KernelMode;
+    Irp->RequestorMode = PreviousMode;
     Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
     Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
     Irp->UserIosb = IoStatusBlock;
@@ -2929,7 +2929,7 @@
     /* Set the IRP */
     Irp->Tail.Overlay.OriginalFileObject = FileObject;
     Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-    Irp->RequestorMode = KernelMode;
+    Irp->RequestorMode = PreviousMode;
     Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
     Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
     Irp->UserIosb = IoStatusBlock;



More information about the Ros-diffs mailing list