ntdll: Avoid possible deadlock by using _exit() in NtTerminateProcess.

Sebastian Lackner sebastian at fds-team.de
Thu Jul 16 23:46:47 CDT 2015


When threads are killed with SIGQUIT some locks can be in an undefined state, and it
not safe to call exit handlers. This is not just a theoretic issue, it also happened
in practice (but the probability is very small).

---
 dlls/ntdll/process.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index c69de5e..ca9462a 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -21,11 +21,16 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
@@ -60,7 +65,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
         self = !ret && reply->self;
     }
     SERVER_END_REQ;
-    if (self && handle) exit( exit_code );
+    if (self && handle) _exit( exit_code );
     return ret;
 }
 
-- 
2.4.5



More information about the wine-patches mailing list