After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751845 - crash while initializing xwayland
crash while initializing xwayland
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-07-02 15:22 UTC by Marek Chalupa
Modified: 2015-12-15 14:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bind wayland socket after xwayland is initialized (2.34 KB, patch)
2015-07-02 15:22 UTC, Marek Chalupa
none Details | Review
Bind wayland socket after xwayland is initialized (1.66 KB, patch)
2015-07-10 06:24 UTC, Marek Chalupa
accepted-commit_now Details | Review
Bind wayland socket after xwayland is initialized (1.67 KB, patch)
2015-12-04 15:08 UTC, Marek Chalupa
committed Details | Review

Description Marek Chalupa 2015-07-02 15:22:35 UTC
Created attachment 306638 [details] [review]
Bind wayland socket after xwayland is initialized

Mutter dispatches wayland events while starting Xwayland in order to let Xwayland connect to display and initialize itself. If some wayland client connects during this phase and creates surface, mutter crashes, because it is not still fully initialized.

Attached patch moves binding of wayland socket after xwayland initialization, so that no client see it until xwayland is initialized and so no client can connect to mutter until it is initialized.

Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1193489
Comment 1 Owen Taylor 2015-07-06 18:17:06 UTC
Review of attachment 306638 [details] [review]:

The change looks plausible to me, I'd like confirmation from someone more expert in Xwayland. A style note though.

::: src/wayland/meta-window-wayland.c
@@ +342,3 @@
   MetaWindow *window;
 
+  g_assert (display && "display is not initialized yet");

It's not clear why this needs a check more than any other place which takes a MetaDisplay - if you want to add an assertion, I'd add it xdg_shell_get_xdg_surface(), but honestly, when you hit this race condition, you had a pretty obvious crash, and I don't see the value of an explicit assert.

@@ +343,3 @@
 
+  g_assert (display && "display is not initialized yet");
+  g_assert (surface && "no surface passed for new window");

And definitely no assert here. there's a pattern in GNOME for public APIs for these types of checks

 g_return_val_if_fail(META_IS_DISPLAY(display), NULL);
 g_return_val_if_fail(surface != NULL, NULL);

to avoid an application developer corrupting GTK+ internals and having to debug into GTK+ for a simple mistake. But we don't do it for private Mutter APIs like this in most cases.
Comment 2 Jasper St. Pierre (not reading bugmail) 2015-07-06 20:03:24 UTC
Review of attachment 306638 [details] [review]:

Yeah. This patch looks good, but I don't want the asserts.
Comment 3 Marek Chalupa 2015-07-10 06:24:41 UTC
Created attachment 307194 [details] [review]
Bind wayland socket after xwayland is initialized
Comment 4 Owen Taylor 2015-09-28 13:43:14 UTC
Review of attachment 307194 [details] [review]:

Looks good to commit ... sorry for missing the followup earlier.
Comment 5 Marek Chalupa 2015-12-04 15:08:13 UTC
Created attachment 316773 [details] [review]
Bind wayland socket after xwayland is initialized

rebased to master