From d25e78cefb2002fb6be70352c0bc336410e45fb9 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 25 Feb 2015 23:27:09 +0100 Subject: [PATCH] Added patch to avoid deadlock by using _exit() in NtTerminateProcess. --- debian/changelog | 1 + ...lock-by-using-_exit-in-NtTerminatePr.patch | 44 +++++++++++++++++++ patches/patchinstall.sh | 4 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 patches/ntdll-Threading/0002-ntdll-Avoid-deadlock-by-using-_exit-in-NtTerminatePr.patch diff --git a/debian/changelog b/debian/changelog index 606fce54..1fe4ff2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ wine-staging (1.7.38) UNRELEASED; urgency=low * Added patch to declare pDirectInputCreateEx in a MSVC compatible way (by Amine Khaldi, wine-patched/pull/5). * Added patch to complete and properly pack DNS_HEADER structure (by Amine Khaldi, wine-patched/pull/6). * Added patch to fix race-condition when threads are killed during shutdown. + * Added patch to avoid deadlock by using _exit() in NtTerminateProcess. * Removed patch to properly call DriverUnload when unloading device drivers (accepted upstream). * Removed patch to allow Accept-Encoding for HTTP/1.0 in wininet (accepted upstream). * Removed patch to declare pDirectInputCreateEx in a MSVC compatible way (accepted upstream). diff --git a/patches/ntdll-Threading/0002-ntdll-Avoid-deadlock-by-using-_exit-in-NtTerminatePr.patch b/patches/ntdll-Threading/0002-ntdll-Avoid-deadlock-by-using-_exit-in-NtTerminatePr.patch new file mode 100644 index 00000000..14bd1fed --- /dev/null +++ b/patches/ntdll-Threading/0002-ntdll-Avoid-deadlock-by-using-_exit-in-NtTerminatePr.patch @@ -0,0 +1,44 @@ +From c16a0e4ac4e504a66a3337c0487da33100aab0a5 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 25 Feb 2015 21:33:36 +0100 +Subject: ntdll: Avoid deadlock by using _exit() in NtTerminateProcess. + +Other threads are killed with SIGQUIT, so there is no guarantee that we can +terminate properly with exit(). +--- + 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 3ac8d52..d20e107 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 + #include + #include + #include + #include ++#ifdef HAVE_UNISTD_H ++# include ++#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.3.0 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 209e2e02..e07143e9 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2750,12 +2750,14 @@ fi # Patchset ntdll-Threading # | # | Modified files: -# | * dlls/ntdll/thread.c +# | * dlls/ntdll/process.c, dlls/ntdll/thread.c # | if test "$enable_ntdll_Threading" -eq 1; then patch_apply ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch + patch_apply ntdll-Threading/0002-ntdll-Avoid-deadlock-by-using-_exit-in-NtTerminatePr.patch ( echo '+ { "Sebastian Lackner", "ntdll: Fix race-condition when threads are killed during shutdown.", 1 },'; + echo '+ { "Sebastian Lackner", "ntdll: Avoid deadlock by using _exit() in NtTerminateProcess.", 1 },'; ) >> "$patchlist" fi