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

commit 8a0495063b9446e8d940fa64fadd30046c733711
Author:     Bernhard Feichtinger <[email protected]>
AuthorDate: Tue Nov 13 20:45:27 2018 +0100
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Sun Nov 25 11:29:18 2018 +0100

    [NTOS:MM] Handle unimplemeted case for MiCheckForUserStackOverflow
---
 ntoskrnl/mm/ARM3/pagfault.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index c75c4596e6..77aaf754df 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -81,8 +81,29 @@ MiCheckForUserStackOverflow(IN PVOID Address,
     /* Do we have at least one page between here and the end of the stack? */
     if (((ULONG_PTR)NextStackAddress - PAGE_SIZE) <= 
(ULONG_PTR)DeallocationStack)
     {
-        /* We don't -- Windows would try to make this guard page valid now */
+        /* We don't -- Trying to make this guard page valid now */
         DPRINT1("Close to our death...\n");
+
+        /* Calculate the next memory address */
+        NextStackAddress = (PVOID)((ULONG_PTR)PAGE_ALIGN(DeallocationStack) + 
GuranteedSize);
+
+        /* Allocate the memory */
+        Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
+                                         &NextStackAddress,
+                                         0,
+                                         &GuranteedSize,
+                                         MEM_COMMIT,
+                                         PAGE_READWRITE);
+        if (NT_SUCCESS(Status))
+        {
+            /* Success! */
+            Teb->NtTib.StackLimit = NextStackAddress;
+        }
+        else
+        {
+            DPRINT1("Failed to allocate memory\n");
+        }
+
         return STATUS_STACK_OVERFLOW;
     }
 

Reply via email to