Segfault on HDMI output (un)plugging
In Apertis v2023, agl-compositor
is crashing (SIGV) in the libweston
drm-backend
when the HDMI output is unplugged or plugged in.
This always happens and has been tested on a Raspberry Pi 4B and an Up Squared 6000 board.
The issue doesn't appear with an older kernel. I did a bisect on the kernel on the Raspberry Pi 4B and found that this commit is the culprit.
This is specific to the Broadcom graphics driver, so maybe there is a similar change in the i915 driver that has the same repercussions on weston
on the Up Squared 6000 (I didn't bisect on that one).
The versions we use on Apertis v2023 are:
-
weston
:9.0.0
-
agl-compositor
:10.93.0
-
maynard
:0.2022.14
-
linux
:6.0.3
(The issue does not happen with linux5.15
)
Here is the log when unplugging with some debug:
Nov 25 15:56:59 apertis agl-compositor[2027]: Date: 2022-11-25 UTC
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.514] Using config file '/etc/xdg/weston/agl-compositor.ini'.
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.514] Output repaint window is 7 ms maximum.
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.514] Loading module '/usr/lib/x86_64-linux-gnu/libweston-9/drm-backend.so'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.516] initializing drm backend
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.518] logind: session control granted
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.520] using /dev/dri/card0
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.520] DRM: supports atomic modesetting
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.520] DRM: supports GBM modifiers
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.520] DRM: supports picture aspect ratio
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.520] Loading module '/usr/lib/x86_64-linux-gnu/libweston-9/gl-renderer.so'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.571] EGL client extensions: EGL_EXT_device_base
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_EXT_device_enumeration EGL_EXT_device_query
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_EXT_platform_wayland EGL_KHR_platform_wayland
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_gbm
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.573] EGL version: 1.5
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.573] EGL vendor: Mesa Project
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.573] EGL client APIs: OpenGL OpenGL_ES
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.573] EGL extensions: EGL_ANDROID_blob_cache
[snip]
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL_MESA_query_driver EGL_WL_bind_wayland_display
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.573] EGL_KHR_surfaceless_context available
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.578] GL version: OpenGL ES 3.2 Mesa 20.3.5
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.578] GLSL version: OpenGL ES GLSL ES 3.20
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.578] GL vendor: Intel
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.578] GL renderer: Mesa Intel(R) UHD Graphics (EHL)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.578] GL extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays
[snip]
Nov 25 15:56:59 apertis agl-compositor[2027]: GL_EXT_texture_query_lod
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.579] GL ES 2 renderer features:
Nov 25 15:56:59 apertis agl-compositor[2027]: read-back format: BGRA
Nov 25 15:56:59 apertis agl-compositor[2027]: wl_shm sub-image to texture: yes
Nov 25 15:56:59 apertis agl-compositor[2027]: EGL Wayland extension: yes
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.586] event2 - Power Button: is tagged by udev as: Keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.586] event2 - Power Button: device is a keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.588] event3 - Video Bus: is tagged by udev as: Keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.588] event3 - Video Bus: device is a keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.590] event1 - Power Button: is tagged by udev as: Keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.590] event1 - Power Button: device is a keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.592] event0 - Sleep Button: is tagged by udev as: Keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.592] event0 - Sleep Button: device is a keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.594] event5 - Asus WMI hotkeys: is tagged by udev as: Keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.594] event5 - Asus WMI hotkeys: device is a keyboard
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.596] event4 - PC Speaker: not tagged as supported input device
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.596] event4 - not using input device '/dev/input/event4'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.637] DRM: head 'HDMI-A-1' found, connector 239 is connected, EDID make 'PHL', model 'PHL 273V7', serial '9428'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.637] DRM: head 'DP-1' found, connector 249 is disconnected.
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.637] Registered plugin API 'weston_drm_output_api_v1' of size 24
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.637] Registered plugin API 'weston_drm_virtual_output_api_v1' of size 48
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.637] Loading module '/usr/lib/x86_64-linux-gnu/libweston-9/remoting-plugin.so'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.641] Registered plugin API 'weston_remoting_api_v1' of size 64
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.648] Seat 0x557d5b20cf90, cursor is not set
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.648] Installing 'allow-all' policy engine
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] Chosen EGL config details: id: 61 rgba: 8 8 8 0 buf: 24 dep: 0 stcl: 0 int: 1-1 type: win vis_id: XRGB8888 (0x34325258)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] Output HDMI-A-1 (crtc 98) video modes:
Nov 25 15:56:59 apertis agl-compositor[2027]: 1920x1080@60.0, preferred, current, 148.5 MHz
[snip]
Nov 25 15:56:59 apertis agl-compositor[2027]: 720x400@70.1, 28.3 MHz
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] associating input device event2 with output HDMI-A-1 (none by udev)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] associating input device event3 with output HDMI-A-1 (none by udev)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] associating input device event1 with output HDMI-A-1 (none by udev)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] associating input device event0 with output HDMI-A-1 (none by udev)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] associating input device event5 with output HDMI-A-1 (none by udev)
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] Output 'HDMI-A-1' enabled with head(s) HDMI-A-1
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.649] launching' /usr/bin/maynard'
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.650] Screenshooter interface created
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.650] info: add 1 socket(s) provided by systemd
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.650] Sending ready to systemd
Nov 25 15:56:59 apertis systemd[554]: Started agl-compositor, a Wayland compositor, as a system service.
Nov 25 15:56:59 apertis maynard[2033]: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
Nov 25 15:56:59 apertis maynard[2033]: failed to setup mixer: No such file or directory
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.975] Added surface 0x557d5b8a5790, app_id (null) to pending list
Nov 25 15:56:59 apertis agl-compositor[2027]: [15:56:59.975] Added surface 0x557d5b8a69d0, app_id (null) to pending list
Nov 25 15:57:00 apertis maynard[2033]: New advertisement app id maynard
Nov 25 15:57:00 apertis maynard[2033]: New advertisement app id maynard
Nov 25 15:57:00 apertis agl-compositor[2027]: [15:57:00.975] (background) position view 0x557d5b8a5dc0, x 0, y 0, on output HDMI-A-1
Nov 25 15:57:00 apertis agl-compositor[2027]: [15:57:00.975] (panel) geom.width 100, geom.height 1080, geom.x 0, geom.y 0
Nov 25 15:57:00 apertis agl-compositor[2027]: [15:57:00.975] (panel) edge 2 position view 0x557d5b8a6a70, x 0, y 0
Nov 25 15:57:00 apertis agl-compositor[2027]: [15:57:00.975] panel type 2 inited on output HDMI-A-1
Nov 25 15:57:00 apertis agl-compositor[2027]: [15:57:00.975] Usable area: 1820x1080+100,0
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.771] DRM: head 'HDMI-A-1' updated, connector 239 is disconnected.
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.771] Output 'HDMI-A-1' no heads left, disabling.
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.771] Disabling output HDMI-A-1
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] output for input device event2 removed
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] output for input device event3 removed
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] output for input device event1 removed
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] output for input device event0 removed
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] output for input device event5 removed
Nov 25 15:57:03 apertis agl-compositor[2027]: [15:57:03.788] Disabling output HDMI-A-1
Nov 25 15:57:03 apertis maynard[2033]: Error reading events from display: Broken pipe
Nov 25 15:57:03 apertis systemd[554]: agl-compositor.service: Main process exited, code=killed, status=11/SEGV
And the backtrace:
Thread 1 "agl-compositor" received signal SIGSEGV, Segmentation fault.
0x00007ff042bae483 in drm_output_start_repaint_loop (output_base=0x55739349b060) at ../libweston/backend-drm/drm.c:541
541 ../libweston/backend-drm/drm.c: No such file or directory.
(gdb) bt
#0 0x00007ff042bae483 in drm_output_start_repaint_loop (output_base=0x55739349b060) at ../libweston/backend-drm/drm.c:541
#1 0x00007ff043351349 in idle_repaint (data=0x55739349b060) at ../libweston/compositor.c:3060
#2 0x00007ff04338e3ab in wl_event_loop_dispatch_idle () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#3 0x00007ff04338e4e5 in wl_event_loop_dispatch () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#4 0x00007ff04338c105 in wl_display_run () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#5 0x0000557391a49e9c in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.c:1605
(gdb) p *output_base
$1 = {id = 4294967295, name = 0x55739349b4d0 "HDMI-A-1", user_destroy_signal = {listener_list = {prev = 0x55739349afb8, next = 0x55739349afb8}}, renderer_state = 0x55739349d5e0, link = {prev = 0x557393104d50,
next = 0x557393104d50}, compositor = 0x557393104b90, matrix = {d = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, type = 1}, inverse_matrix = {d = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1},
type = 1}, animation_list = {prev = 0x55739349b128, next = 0x55739349b128}, x = 0, y = 0, width = 1920, height = 1080, region = {extents = {x1 = 0, y1 = 0, x2 = 1920, y2 = 1080}, data = 0x0},
repaint_needed = true, repainted = false, repaint_status = REPAINT_AWAITING_COMPLETION, next_repaint = {tv_sec = 4558, tv_nsec = 235730666}, idle_repaint_source = 0x0, zoom = {active = false,
increment = 0.0700000003, level = 0, max_level = 0.949999988, trans_x = 0, trans_y = 0, current = {x = 0, y = 0}, seat = 0x0, animation_z = {frame = 0x7ff04336c100 <weston_zoom_frame_z>, frame_counter = 0,
link = {prev = 0x55739349b1c0, next = 0x55739349b1c0}}, spring_z = {k = 250, friction = 1000, current = 0, target = 0, previous = 0, min = 0, max = 1, timestamp = {tv_sec = 0, tv_nsec = 0}, clip = 0},
motion_listener = {link = {prev = 0x0, next = 0x0}, notify = 0x7ff04336c460 <motion>}}, dirty = 0, frame_signal = {listener_list = {prev = 0x55739349b240, next = 0x55739349b240}}, destroy_signal = {
listener_list = {prev = 0x55739349dfc0, next = 0x55739349dfc0}}, move_x = 0, move_y = 0, frame_time = {tv_sec = 4558, tv_nsec = 226064000}, msc = 73094, disable_planes = 0, destroying = 0, feedback_list = {
prev = 0x55739349b288, next = 0x55739349b288}, transform = 0, native_scale = 1, current_scale = 1, original_scale = 1, native_mode = 0x55739348d0d0, current_mode = 0x55739348d0d0, original_mode = 0x0,
mode_list = {prev = 0x55739349c648, next = 0x55739348d0e8}, head_list = {prev = 0x55739349b2d0, next = 0x55739349b2d0}, desired_protection = WESTON_HDCP_DISABLE, current_protection = WESTON_HDCP_DISABLE,
allow_protection = true, start_repaint_loop = 0x7ff042bae430 <drm_output_start_repaint_loop>, repaint = 0x7ff042bb1030 <drm_output_repaint>, destroy = 0x7ff042badf00 <drm_output_destroy>, assign_planes =
0x7ff042bb87d0 <drm_assign_planes>, switch_mode = 0x7ff042bae920 <drm_output_switch_mode>, backlight_current = 0, set_backlight = 0x0, set_dpms = 0x7ff042bafa00 <drm_set_dpms>, gamma_size = 256,
set_gamma = 0x7ff042bb5aa0 <drm_output_set_gamma>, enabled = false, scale = 1, enable = 0x7ff042bb0170 <drm_output_enable>, disable = 0x7ff042baf250 <drm_output_disable>, attach_head =
0x7ff042bae3d0 <drm_output_attach_head>, detach_head = 0x7ff042badbc0 <drm_output_detach_head>}
(gdb) p output
$2 = (struct drm_output *) 0x55739349b060
(gdb) p *output
Cannot access memory at address 0x55739349b060
I tried applying the following patches on weston
but the same issue happened:
The issue may not be in weston
, but in maynard
or agl-compositor
or somewhere else, let me know if I need to report this there too.