ntdll: try to detect and warn about stack overflow into TEB

Austin English austinenglish at gmail.com
Thu Jul 9 16:30:56 CDT 2009


Patch by John Reiser. Originally sent last year in the lead up to 1.0.
See bug 14369.

--
-Austin
-------------- next part --------------
From a826d4e5150bf2072de47151755f1478e53ee5a4 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser at BitWagon.com>
Date: Thu, 9 Jul 2009 16:28:54 -0500
Subject: [PATCH] ntdll: try to detect and warn about stack overflow into TEB

---
 dlls/ntdll/thread.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 0c73ffd..7e2819b 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -42,6 +42,10 @@
 #include "ddk/wdm.h"
 #include "wine/exception.h"
 
+#if HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
 WINE_DEFAULT_DEBUG_CHANNEL(thread);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
 
@@ -279,6 +283,9 @@ HANDLE thread_init(void)
     NtAllocateVirtualMemory( NtCurrentProcess(), &addr, sigstack_zero_bits,
                              &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE );
     teb = addr;
+#if defined(VALGRIND_SET_BOGEY)
+    VALGRIND_SET_BOGEY(1+ teb);
+#endif
     teb->Peb = peb;
     init_teb( teb );
     thread_data = (struct ntdll_thread_data *)teb->SystemReserved2;
-- 
1.5.4.3


More information about the wine-patches mailing list