xserver/hw/xwayland
Olivier Fourdan 9617de733b xwayland: Cancel the EI disconnect timer when freed
Xwayland maintains a connection to EI up for 10 minutes after an X11
client has vanished, to avoid going through the connection phase every
time a short lived X11 client comes and goes.

However, if the EI client gets freed (through some other event, e.g. the
user decides to terminate the EI session), Xwayland would still keep the
callback alive and end up trying to free an already freed EI client:

 Invalid read of size 4
    at 0x4C5E6F9: object_unref (util-object.h:89)
    by 0x4C5E6F9: ei_unref (libei.c:77)
    by 0x429525: free_ei (xwayland-xtest.c:224)
    by 0x429A6E: disconnect_timer_cb (xwayland-xtest.c:404)
    by 0x5E63FF: DoTimer (WaitFor.c:276)
    by 0x5E6463: DoTimers (WaitFor.c:290)
    by 0x5E6164: check_timers (WaitFor.c:133)
    by 0x5E61E9: WaitForSomething (WaitFor.c:195)
    by 0x4AD50E: Dispatch (dispatch.c:487)
    by 0x4BBA0B: dix_main (main.c:272)
    by 0x43615D: main (stubmain.c:34)
  Address 0x15cc6ee8 is 8 bytes inside a block of size 240 free'd
    at 0x48452AC: free (vg_replace_malloc.c:974)
    by 0x4C5E729: object_destroy (util-object.h:73)
    by 0x4C5E729: object_unref (util-object.h:91)
    by 0x4C5E729: ei_unref (libei.c:77)
    by 0x429525: free_ei (xwayland-xtest.c:224)
    by 0x42A946: xwl_handle_ei_event (xwayland-xtest.c:804)
    by 0x5EA977: HandleNotifyFd (connection.c:809)
    by 0x5EE8E3: ospoll_wait (ospoll.c:657)
    by 0x5E624D: WaitForSomething (WaitFor.c:208)
    by 0x4AD50E: Dispatch (dispatch.c:487)
    by 0x4BBA0B: dix_main (main.c:272)
    by 0x43615D: main (stubmain.c:34)
  Block was alloc'd at
    at 0x484782C: calloc (vg_replace_malloc.c:1554)
    by 0x4C5E777: ei_create (libei.c:73)
    by 0x4C5E777: ei_create_context (libei.c:97)
    by 0x42994B: setup_ei (xwayland-xtest.c:366)
    by 0x42A383: xwayland_xtest_send_events (xwayland-xtest.c:658)
    by 0x54ED4C: ProcXTestFakeInput (xtest.c:441)
    by 0x54EE56: ProcXTestDispatch (xtest.c:475)
    by 0x4AD6E6: Dispatch (dispatch.c:546)
    by 0x4BBA0B: dix_main (main.c:272)
    by 0x43615D: main (stubmain.c:34)

To avoid that issue, make sure to cancel the timer as soon as a EI
client is freed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
See-also: https://bugzilla.redhat.com/2243076
2023-10-11 11:05:08 +02:00
..
desktop xwayland: set the app_id and install a desktop launcher 2022-06-30 17:53:01 +02:00
man xwayland: Add an option to enable EI portal support 2023-10-09 07:33:09 +00:00
.gitignore xwayland: Add wp_viewport wayland extension support 2019-10-12 12:19:14 +02:00
drm.xml wayland: Sync drm.xml with Mesa 2017-07-05 10:13:04 -04:00
meson.build xwayland: Add an option to enable EI portal support 2023-10-09 07:33:09 +00:00
xwayland-cursor.c xwayland: Fix cursor color 2022-02-11 10:33:10 +01:00
xwayland-cursor.h xwayland: Add xwl_cursor_clear_frame_cb() 2021-10-25 12:05:42 +00:00
xwayland-cvt.c xwayland: Keep the CVT timings for non-standard modes 2023-05-15 10:33:21 +02:00
xwayland-cvt.h xwayland: Move Xwayland CVT declaration 2019-12-20 16:19:01 +01:00
xwayland-drm-lease.c xwayland: Clean up drm lease when terminating. #946 2023-07-17 08:25:39 +00:00
xwayland-drm-lease.h Xwayland: implement drm-lease-v1 2021-12-07 10:02:29 +00:00
xwayland-glamor-eglstream.c xwayland: Add get_drawable_modifiers implementation 2023-01-20 17:56:54 +00:00
xwayland-glamor-gbm.c xwayland/glamor/gbm: Set GBM_BO_USE_LINEAR if only LINEAR modifier is supported 2023-10-04 14:37:45 +02:00
xwayland-glamor-xv.c xwayland: Cleanup and remove `xwayland.h` 2019-12-20 16:19:01 +01:00
xwayland-glamor.c xwayland/glamor: Avoid implicit redirection with depth 32 parent windows 2023-07-20 10:15:15 +02:00
xwayland-glamor.h xwayland/glamor: Require equal pixmap depths in xwl_glamor_check_flip 2023-07-18 09:34:39 +00:00
xwayland-glx.c xwayland/glx: Mirror all EGLConfigs 2022-12-06 12:48:58 -05:00
xwayland-glx.h xwayland: Move Xwayland GLX declaration 2019-12-20 16:19:01 +01:00
xwayland-input.c xwayland: Fallback to plain XTEST if EI does not work 2023-06-26 13:19:19 +02:00
xwayland-input.h xwayland: hook up wl_pointer.axis_v120 events 2023-01-18 13:33:54 +10:00
xwayland-output.c xwayland: Make xwl_randr_add_modes_fixed() public API 2023-07-18 12:25:26 +02:00
xwayland-output.h xwayland: Make xwl_randr_add_modes_fixed() public API 2023-07-18 12:25:26 +02:00
xwayland-pixmap.c xwayland: Rename xwl_pixmap_cb → xwl_buffer_release_cb 2020-07-07 13:47:11 +00:00
xwayland-pixmap.h xwayland: Rename xwl_pixmap_cb → xwl_buffer_release_cb 2020-07-07 13:47:11 +00:00
xwayland-present.c xwayland/present: Handle NULL window_priv in xwl_present_cleanup 2023-09-26 14:08:08 +00:00
xwayland-present.h xwayland: add support for wp-tearing-control-v1 2023-06-19 12:19:35 +02:00
xwayland-screen.c xwayland: Add an option to enable EI portal support 2023-10-09 07:33:09 +00:00
xwayland-screen.h xwayland: Add an option to enable EI portal support 2023-10-09 07:33:09 +00:00
xwayland-shm.c xwayland/shm: Avoid integer overflow on large pixmaps 2021-10-05 10:00:02 +00:00
xwayland-shm.h xwayland: Move SHM declarations to their own header 2019-12-20 16:19:01 +01:00
xwayland-types.h Xwayland: implement drm-lease-v1 2021-12-07 10:02:29 +00:00
xwayland-vidmode.c xwayland: add a fixed geometry size for rootful 2022-06-30 17:52:22 +02:00
xwayland-vidmode.h xwayland: Move Xwayland vidmode declaration 2019-12-20 16:19:01 +01:00
xwayland-window-buffers.c xwayland: Try the Xwayland glamor hook to create pixmaps 2023-04-03 11:46:15 +02:00
xwayland-window-buffers.h xwayland: Cleanup and remove `xwayland.h` 2019-12-20 16:19:01 +01:00
xwayland-window.c xwayland: Apply root toplevel configure dimensions 2023-08-11 17:26:35 +02:00
xwayland-window.h xwayland: add support for wp-tearing-control-v1 2023-06-19 12:19:35 +02:00
xwayland-xtest.c xwayland: Cancel the EI disconnect timer when freed 2023-10-11 11:05:08 +02:00
xwayland-xtest.h xwayland: Fallback to plain XTEST if EI does not work 2023-06-26 13:19:19 +02:00
xwayland.c xwayland: Add an option to enable EI portal support 2023-10-09 07:33:09 +00:00