summaryrefslogtreecommitdiff
path: root/desktop-shell/shell.h
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-08-27 12:11:53 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-08-28 10:15:38 +0300
commit826dc14ec43b92d992d8cf73cfdfde132c3f814f (patch)
tree3942699ba19e722d2ed3d7139ee53a72392d288a /desktop-shell/shell.h
parent9c1ac7b220455f6a58a51517b7bc8bee9364a47c (diff)
downloadweston-826dc14ec43b92d992d8cf73cfdfde132c3f814f.tar.gz
shell: fix race on desktop-shell exit
The desktop shell plugin registers both a wl_client destroy signal listener, and a sigchld handler, when launching weston-desktop-shell. However, nothing guarantees in which order do the wl_client destructor and the sigchld handler run. Luckily, the sigchld handler cannot interrupt any code, because we handle the signal via signalfd, which means it is handled like any event in the compositor's main event loop. Still, shell.c has a race, that when lost, can cause a crash, as described in bug #82957. If the sigchld handler happens to run first, it will try to launch a new weston-desktop-shell without removing the destroy listener from the old wl_client first. This leads to list corruption, that may cause a crash when the old wl_client gets destroyed. Simply removing the destroy listener in the sigchld handler is not enough, because respawning sets shell->child.client pointer, and if the wl_client destructor runs after, it will reset it to NULL. OTOH, the wl_client destroy handler cannot reset shell->child.process, because that would cause the sigchld handler in weston core to not find the process tracker anymore, and report that an unknown process exited. Turns out, that to make everything work, we would need to wait for both the wl_client destructor and the sigchld handler to have run, before respawn. This gets tricky. Instead, solve the problem by removing shell->child.process. Use the new weston_client_start() which automatically creates and manages the struct weston_process. The shell does not need to know about the process exit, it only needs to know about the client disconnect. Weston-desktop-shell will never attempt to reconnect, and it would not work even if it did, so disconnect is equivalent to weston-desktop-shell exiting. This should permanently solve the race for weston-desktop-shell. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82957 Cc: Boyan Ding <stu_dby@126.com> Cc: Derek Foreman <derekf@osg.samsung.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Diffstat (limited to 'desktop-shell/shell.h')
-rw-r--r--desktop-shell/shell.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index c6ea3288..67c5f50f 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -134,7 +134,6 @@ struct desktop_shell {
struct weston_surface *grab_surface;
struct {
- struct weston_process process;
struct wl_client *client;
struct wl_resource *desktop_shell;
struct wl_listener client_destroy_listener;