https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e45af60560c5d030d70df0c787f07d214c5a6250

commit e45af60560c5d030d70df0c787f07d214c5a6250
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sat Jul 23 16:19:52 2022 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Thu Aug 4 16:15:24 2022 +0200

    [NTOS:KE/X64] Enable interrupts when accessing user mode memory
---
 ntoskrnl/ke/amd64/except.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ntoskrnl/ke/amd64/except.c b/ntoskrnl/ke/amd64/except.c
index a04d3038bd9..c9c97c9dd2f 100644
--- a/ntoskrnl/ke/amd64/except.c
+++ b/ntoskrnl/ke/amd64/except.c
@@ -119,6 +119,9 @@ KiDispatchExceptionToUser(
     /* Get pointer to the usermode context, exception record and machine frame 
*/
     UserStack = (PKUSER_EXCEPTION_STACK)UserRsp;
 
+    /* Enable interrupts */
+    _enable();
+
     /* Set up the user-stack */
     _SEH2_TRY
     {
@@ -143,6 +146,7 @@ KiDispatchExceptionToUser(
         // FIXME: handle stack overflow
 
         /* Nothing we can do here */
+        _disable();
         _SEH2_YIELD(return);
     }
     _SEH2_END;
@@ -165,6 +169,8 @@ KiDispatchExceptionToUser(
     /* Set RIP to the User-mode Dispatcher */
     TrapFrame->Rip = (ULONG64)KeUserExceptionDispatcher;
 
+    _disable();
+
     /* Exit to usermode */
     KiServiceExit2(TrapFrame);
 }
@@ -202,6 +208,9 @@ KiPrepareUserDebugData(void)
     Teb = KeGetCurrentThread()->Teb;
     if (!Teb) return;
 
+    /* Enable interrupts */
+    _enable();
+
     _SEH2_TRY
     {
         /* Get a pointer to the loader data */
@@ -230,6 +239,8 @@ KiPrepareUserDebugData(void)
     {
     }
     _SEH2_END;
+
+    _disable();
 }
 
 VOID

Reply via email to