Skip to content

compositor: fix shutdown when xwayland failed to start

Pekka Paalanen requested to merge pq/weston:mr/xwfix into main

This patch fixes the following:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==528956==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7fbc5d66bdd7 bp 0x7ffd465573c0 sp 0x7ffd46557398 T0)
==528956==The signal is caused by a WRITE memory access.
==528956==Hint: address points to the zero page.
    #0 0x7fbc5d66bdd7 in wl_list_remove ../../git/wayland/src/wayland-util.c:56
    #1 0x7fbc5cb8869e in wxw_compositor_destroy ../../git/weston/compositor/xwayland.c:357
    #2 0x7fbc5baf3ca6 in weston_signal_emit_mutable ../../git/weston/shared/signal.c:62
    #3 0x7fbc5ba4d6f9 in weston_compositor_destroy ../../git/weston/libweston/compositor.c:8639
    #4 0x7fbc5cb7a5f2 in wet_main ../../git/weston/compositor/main.c:3772
    #5 0x55bd13de2179 in main ../../git/weston/compositor/executable.c:33
    #6 0x7fbc5be61d09 in __libc_start_main ../csu/libc-start.c:308
    #7 0x55bd13de2099 in _start (/home/pq/local/bin/weston+0x1099)

The problem is triggered by configuring a bad path to Xwayland in weston.ini, which causes exec() to fail. The fork() succeeded though, which means the weston_process was already on the watch list, and the watch can be handled, making sigchl_handler() leave the link uninitialized.

Making sure the link remains removable fixes this.

Fixes: 18897253

cc @daniels

Merge request reports