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 761120 - vino segfaults on wayland
vino segfaults on wayland
Status: RESOLVED FIXED
Product: vino
Classification: Applications
Component: Server
unspecified
Other Linux
: Normal critical
: ---
Assigned To: Vino Maintainer(s)
Vino Maintainer(s)
Depends on:
Blocks: WaylandRelated
 
 
Reported: 2016-01-26 07:47 UTC by Ondrej Holy
Modified: 2018-05-23 07:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Return error if X11 is not detected (1.12 KB, patch)
2018-02-20 12:37 UTC, Ondrej Holy
none Details | Review
Return error if X11 is not detected (1.08 KB, patch)
2018-02-21 13:50 UTC, Ondrej Holy
committed Details | Review
Do not restart service after unclean exit code (1.14 KB, patch)
2018-05-23 07:07 UTC, Ondrej Holy
committed Details | Review

Description Ondrej Holy 2016-01-26 07:47:43 UTC
It would be nice to return some error on wayland instead of the following segfault:

Program received signal SIGSEGV, Segmentation fault.
  • #0 0x000000000088dae0 in
  • #1 XQueryExtension
  • #2 find_display
  • #3 XTestQueryExtension
  • #4 vino_input_init
  • #5 name_acquired
  • #6 do_call
  • #7 request_name_cb
  • #8 g_simple_async_result_complete
  • #9 g_dbus_connection_call_done
  • #10 g_simple_async_result_complete
  • #11 complete_in_idle_cb
  • #12 g_main_context_dispatch
  • #13 g_main_context_iterate.isra
  • #14 g_main_loop_run
  • #15 main

See downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1211040
Comment 2 Bastien Nocera 2016-11-16 16:11:34 UTC
It should exit gracefully when X is unavailable.
Comment 3 Ondrej Holy 2018-02-20 12:37:11 UTC
Created attachment 368635 [details] [review]
Return error if X11 is not detected

Vino-server crashes on Wayland in XQueryExtension. Since vino-server is
not expected to work on displays other than X11, let's exit immediately
if GDK_IS_X11_DISPLAY fail.
Comment 4 Andrea Veri 2018-02-20 13:50:30 UTC
Review of attachment 368635 [details] [review]:

This is a test, please ignore.
Comment 5 Bastien Nocera 2018-02-21 10:58:44 UTC
Review of attachment 368635 [details] [review]:

::: server/vino-main.c
@@ +237,3 @@
   textdomain (GETTEXT_PACKAGE);
 
+  if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))

I don't think you run that before gtk_init(). And it will fail in gtk_init().

Maybe use:
gdk_set_allowed_backends()
instead, and use gtk_init_check() to avoid asserting if X11 isn't available.
Comment 6 Ondrej Holy 2018-02-21 13:49:28 UTC
Hmm, gdk_set_allowed_backends ("x11"); seems to force XWayland to be used, which is not desired. Consequently, vino-server starts without crash, however, it crashes on XGetImage when trying to establish a connection:

(vino-server:12170): Gdk-ERROR **: 13:31:55.982: The program 'vino-server' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 253 error_code 8 request_code 73 (core protocol) minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

So, not sure what is a right way to do the check...
Comment 7 Ondrej Holy 2018-02-21 13:50:03 UTC
Created attachment 368712 [details] [review]
Return error if X11 is not detected

Move the check after gtk_init, respectively g_option_context_parse.
Comment 8 Ondrej Holy 2018-05-17 11:27:21 UTC
It seems that Arch Linux is using this patch already:
https://git.archlinux.org/svntogit/packages.git/commit/trunk/dont-crash-on-wayland.patch?h=packages/vino&id=e251c1cb96dc2a57f32ef2dd40154dd84a770b1f

Is there any chance that somebody can review this patch?
Comment 9 David King 2018-05-18 12:04:17 UTC
Review of attachment 368712 [details] [review]:

Sure, seems fine.
Comment 10 Ondrej Holy 2018-05-18 12:09:52 UTC
Thanks!

Attachment 368712 [details] pushed as d5b743b - Return error if X11 is not detected
Comment 11 Ondrej Holy 2018-05-23 07:07:33 UTC
Created attachment 372353 [details] [review]
Do not restart service after unclean exit code

Currently, the vino-server.service has Restart=on-failure, which means
that it is restarted in abnormal cases, but also in case of non-zero
exit code. It is restarted 5 times e.g. in case when X11 is not detected,
which doesn't make sense. Non-zero exit code is used only for states
which won't change with restart (invalid commandline, wayland and some
sanity checks). Change the value to Restart=on-abnormal in order to
prevent the useless restarts and to not spam journal.
Comment 12 David King 2018-05-23 07:09:22 UTC
Review of attachment 372353 [details] [review]:

Sure.
Comment 13 Ondrej Holy 2018-05-23 07:18:04 UTC
Thanks!

Attachment 372353 [details] pushed as c5e3011 - Do not restart service after unclean exit code