Added patch to delay signaling threads until they are really gone (fixes Wine Staging Bug #473).

This commit is contained in:
Sebastian Lackner 2015-10-19 00:38:33 +02:00
parent 922e5a0e06
commit be51f622f7
7 changed files with 134 additions and 22 deletions

View File

@ -34,12 +34,13 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [9]:**
**Bug fixes and features included in the next upcoming release [10]:**
* Add implementation for IDXGIOutput::GetDesc ([Wine Bug #32006](https://bugs.winehq.org/show_bug.cgi?id=32006))
* Add implementation for comctl32.PROPSHEET_InsertPage. ([Wine Bug #25625](https://bugs.winehq.org/show_bug.cgi?id=25625))
* Always use 64-bit registry view on WOW64 setups
* Do not check if object was signaled after user APC in server_select
* Do not signal threads until they are really gone
* Fix the initialization of combined DACLs when the new DACL is empty ([Wine Bug #38423](https://bugs.winehq.org/show_bug.cgi?id=38423))
* Implement kernel32.GetPhysicallyInstalledSystemMemory ([Wine Bug #39395](https://bugs.winehq.org/show_bug.cgi?id=39395))
* Return WN_NOT_CONNECTED from WNetGetUniversalName REMOTE_NAME_INFO_LEVEL stub ([Wine Bug #39452](https://bugs.winehq.org/show_bug.cgi?id=39452))

2
debian/changelog vendored
View File

@ -14,6 +14,8 @@ wine-staging (1.7.53) UNRELEASED; urgency=low
REMOTE_NAME_INFO_LEVEL stub.
* Added patch to always use 64-bit registry view on WOW64 setups.
* Added patch to implement kernel32.GetPhysicallyInstalledSystemMemory.
* Added patch to delay signaling threads until they are really gone (fixes
Wine Staging Bug #473).
* Removed patch to mark RegOpenKeyExA, RegCloseKey and RegQueryValueExA as
hotpatchable (accepted upstream).
* Removed patch to mark BitBlt and StretchDIBits as hotpatchable (accepted

View File

@ -244,6 +244,7 @@ patch_enable_all ()
enable_server_Pipe_ObjectName="$1"
enable_server_Realtime_Priority="$1"
enable_server_Shared_Memory="$1"
enable_server_Signal_Thread="$1"
enable_server_Stored_ACLs="$1"
enable_server_Timestamp_Compat="$1"
enable_setupapi_SetupDiSelectBestCompatDrv="$1"
@ -828,6 +829,9 @@ patch_enable ()
server-Shared_Memory)
enable_server_Shared_Memory="$2"
;;
server-Signal_Thread)
enable_server_Signal_Thread="$2"
;;
server-Stored_ACLs)
enable_server_Stored_ACLs="$2"
;;
@ -1790,10 +1794,14 @@ if test "$enable_server_Shared_Memory" -eq 1; then
if test "$enable_server_PeekMessage" -gt 1; then
abort "Patchset server-PeekMessage disabled, but server-Shared_Memory depends on that."
fi
if test "$enable_server_Signal_Thread" -gt 1; then
abort "Patchset server-Signal_Thread disabled, but server-Shared_Memory depends on that."
fi
enable_ntdll_Threading=1
enable_server_ClipCursor=1
enable_server_Key_State=1
enable_server_PeekMessage=1
enable_server_Signal_Thread=1
fi
if test "$enable_server_Pipe_ObjectName" -eq 1; then
@ -4915,10 +4923,22 @@ if test "$enable_server_Realtime_Priority" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Signal_Thread
# |
# | Modified files:
# | * server/thread.c, server/thread.h
# |
if test "$enable_server_Signal_Thread" -eq 1; then
patch_apply server-Signal_Thread/0001-server-Do-not-signal-thread-until-it-is-really-gone.patch
(
echo '+ { "Sebastian Lackner", "server: Do not signal thread until it is really gone.", 1 },';
) >> "$patchlist"
fi
# Patchset server-Shared_Memory
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Threading, server-ClipCursor, server-Key_State, server-PeekMessage
# | * ntdll-Threading, server-ClipCursor, server-Key_State, server-PeekMessage, server-Signal_Thread
# |
# | Modified files:
# | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/server.c, dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/user32/focus.c,

View File

@ -1,4 +1,4 @@
From e56e42a0193c98b3550855edf9f0015e1efc29ca Mon Sep 17 00:00:00 2001
From 0514f064febfdfdd9321c03793e996b6989fb3d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 19 Mar 2015 01:22:34 +0100
Subject: server: Implement support for global and local shared memory blocks
@ -114,10 +114,10 @@ index 95111ad..955c392 100644
ntdll_get_thread_data()->wow64_redir = is_wow64;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 74e64c9..b030afd 100644
index 7633232..c56ee1d 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -370,6 +370,7 @@ void terminate_thread( int status )
@@ -376,6 +376,7 @@ void terminate_thread( int status )
void exit_thread( int status )
{
static void *prev_teb;
@ -125,7 +125,7 @@ index 74e64c9..b030afd 100644
sigset_t sigset;
TEB *teb;
@@ -393,6 +394,9 @@ void exit_thread( int status )
@@ -399,6 +400,9 @@ void exit_thread( int status )
LdrShutdownThread();
RtlFreeThreadActivationContextStack();
@ -158,7 +158,7 @@ index d573d1f..695389a 100644
/* macros for server requests */
diff --git a/include/winternl.h b/include/winternl.h
index a84c6d4..9128ffd 100644
index 5420391..624da00 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -366,7 +366,7 @@ typedef struct _TEB
@ -171,10 +171,10 @@ index a84c6d4..9128ffd 100644
ULONG ImpersonationLocale; /* f98/1788 */
ULONG IsImpersonating; /* f9c/178c */
diff --git a/server/fd.c b/server/fd.c
index f0a52ad..791a36f 100644
index fe778f1..f6f9b42 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2323,6 +2323,33 @@ DECL_HANDLER(write)
@@ -2472,6 +2472,33 @@ DECL_HANDLER(write)
}
}
@ -209,10 +209,10 @@ index f0a52ad..791a36f 100644
DECL_HANDLER(ioctl)
{
diff --git a/server/file.h b/server/file.h
index b5e0ca7..7ffef6f 100644
index b59de1c..8a9f6b9 100644
--- a/server/file.h
+++ b/server/file.h
@@ -145,6 +145,14 @@ extern void create_mailslot_device( struct directory *root, const struct unicode
@@ -146,6 +146,14 @@ extern void create_mailslot_device( struct directory *root, const struct unicode
extern struct device *create_unix_device( struct directory *root, const struct unicode_str *name,
const char *unix_path );
@ -341,7 +341,7 @@ index 16e7c1c..c180ae5 100644
static int create_temp_file( file_pos_t size )
{
diff --git a/server/protocol.def b/server/protocol.def
index 9c4dab4..495365b 100644
index c313006..b8c5abf 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -69,6 +69,15 @@ struct request_max_size
@ -360,7 +360,7 @@ index 9c4dab4..495365b 100644
/* debug event data */
typedef union
@@ -1170,6 +1179,12 @@ enum server_fd_type
@@ -1203,6 +1212,12 @@ enum server_fd_type
};
@ -374,19 +374,19 @@ index 9c4dab4..495365b 100644
@REQ(flush)
int blocking; /* whether it's a blocking flush */
diff --git a/server/thread.c b/server/thread.c
index 6c5d12d..d692a77 100644
index ba84bee..4bb5149 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -194,6 +194,8 @@ static inline void init_thread_structure( struct thread *thread )
thread->suspend = 0;
@@ -196,6 +196,8 @@ static inline void init_thread_structure( struct thread *thread )
thread->desktop_users = 0;
thread->token = NULL;
thread->exit_poll = NULL;
+ thread->shm_fd = -1;
+ thread->shm = NULL;
thread->creation_time = current_time;
thread->exit_time = 0;
@@ -295,6 +297,8 @@ static void cleanup_thread( struct thread *thread )
@@ -297,6 +299,8 @@ static void cleanup_thread( struct thread *thread )
thread->inflight[i].client = thread->inflight[i].server = -1;
}
}
@ -395,7 +395,7 @@ index 6c5d12d..d692a77 100644
thread->req_data = NULL;
thread->reply_data = NULL;
thread->request_fd = NULL;
@@ -303,6 +307,9 @@ static void cleanup_thread( struct thread *thread )
@@ -305,6 +309,9 @@ static void cleanup_thread( struct thread *thread )
thread->context = NULL;
thread->suspend_context = NULL;
thread->desktop = 0;
@ -406,18 +406,18 @@ index 6c5d12d..d692a77 100644
/* destroy a thread when its refcount is 0 */
diff --git a/server/thread.h b/server/thread.h
index 996d95b..0107a45 100644
index ac9af24..59ef250 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -87,6 +87,8 @@ struct thread
timeout_t creation_time; /* Thread creation time */
@@ -89,6 +89,8 @@ struct thread
timeout_t exit_time; /* Thread exit time */
struct token *token; /* security token associated with this thread */
struct timeout_user *exit_poll; /* poll if the thread/process has exited already */
+ int shm_fd; /* file descriptor for thread local shared memory */
+ shmlocal_t *shm; /* thread local shared memory pointer */
};
struct thread_snapshot
--
2.4.0
2.6.1

View File

@ -2,3 +2,4 @@ Depends: ntdll-Threading
Depends: server-Key_State
Depends: server-PeekMessage
Depends: server-ClipCursor
Depends: server-Signal_Thread

View File

@ -0,0 +1,87 @@
From 67856c891a6d40c6e484f5f29db30a8899a39e04 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 19 Oct 2015 00:34:01 +0200
Subject: server: Do not signal thread until it is really gone.
---
server/thread.c | 22 ++++++++++++++++++++--
server/thread.h | 1 +
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/server/thread.c b/server/thread.c
index 6383000..ba84bee 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -195,6 +195,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->suspend = 0;
thread->desktop_users = 0;
thread->token = NULL;
+ thread->exit_poll = NULL;
thread->creation_time = current_time;
thread->exit_time = 0;
@@ -316,6 +317,7 @@ static void destroy_thread( struct object *obj )
list_remove( &thread->entry );
cleanup_thread( thread );
release_object( thread->process );
+ if (thread->exit_poll) remove_timeout_user( thread->exit_poll );
if (thread->id) free_ptid( thread->id );
if (thread->token) release_object( thread->token );
}
@@ -333,7 +335,7 @@ static void dump_thread( struct object *obj, int verbose )
static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
{
struct thread *mythread = (struct thread *)obj;
- return (mythread->state == TERMINATED);
+ return (mythread->state == TERMINATED && !mythread->exit_poll);
}
static unsigned int thread_map_access( struct object *obj, unsigned int access )
@@ -1091,6 +1093,22 @@ int thread_get_inflight_fd( struct thread *thread, int client )
return -1;
}
+static void check_terminated( void *arg )
+{
+ struct thread *thread = arg;
+ assert( thread->obj.ops == &thread_ops );
+ assert( thread->state == TERMINATED );
+
+ if (thread->unix_tid != -1 && !kill( thread->unix_tid, 0 ))
+ {
+ thread->exit_poll = add_timeout_user( -TICKS_PER_SEC / 100, check_terminated, thread );
+ return;
+ }
+
+ thread->exit_poll = NULL;
+ wake_up( &thread->obj, 0 );
+}
+
/* kill a thread on the spot */
void kill_thread( struct thread *thread, int violent_death )
{
@@ -1111,8 +1129,8 @@ void kill_thread( struct thread *thread, int violent_death )
kill_console_processes( thread, 0 );
debug_exit_thread( thread );
abandon_mutexes( thread );
- wake_up( &thread->obj, 0 );
if (violent_death) send_thread_signal( thread, SIGQUIT );
+ check_terminated( thread );
cleanup_thread( thread );
remove_process_thread( thread->process, thread );
release_object( thread );
diff --git a/server/thread.h b/server/thread.h
index 2821991..ac9af24 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -88,6 +88,7 @@ struct thread
timeout_t creation_time; /* Thread creation time */
timeout_t exit_time; /* Thread exit time */
struct token *token; /* security token associated with this thread */
+ struct timeout_user *exit_poll; /* poll if the thread/process has exited already */
};
struct thread_snapshot
--
2.6.1

View File

@ -0,0 +1 @@
Fixes: Do not signal threads until they are really gone