raboof/volare
6
22
Fork
You've already forked volare
2

container_add_placeholder_child(): focus NULL check #87

Merged
raboof merged 1 commit from edmonds/volare:edmonds/crash/container_add_placeholder_child into main 2024年10月08日 09:12:45 +02:00
Collaborator
Copy link

I managed to make volare crash in container_add_placeholder_child(). I think the commonality with the previous crash in container_remove_placeholder_and_parent() is that I happened to be running Zoom at the time, which is definitely an application that stresses tiling window managers. (Albeit, in the background and not actively in a Zoom meeting.)

It looks like seat_get_focused_container() can legitimately return NULL, so we need to add a NULL check before dereferencing the result.

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338
338		if (node->type == N_ROOT || node->type == N_OUTPUT) {
[Current thread is 1 (Thread 0x71ce2a4fdf00 (LWP 94057))]
(gdb) bt
#0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338
#1 0x00005809753868bf in seat_set_raw_focus (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:1169
#2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58
#3 0x00005809753b5c3a in container_reap_empty (con=0x58097730c1a0) at ../sway/tree/container.c:221
#4 0x00005809753bf9c6 in view_unmap (view=0x5809778acec0) at ../sway/tree/view.c:907
#5 0x00005809753798fc in handle_unmap (listener=0x5809778ad0e8, data=0x0) at ../sway/desktop/xdg_shell.c:422
#6 0x000071ce2b4b78fc in wl_signal_emit_mutable () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#7 0x000071ce2bba52ea in wlr_surface_unmap (surface=0x58097784cfc0)
 at ../subprojects/wlroots/types/wlr_compositor.c:761
#8 0x000071ce2bba1bd4 in destroy_xdg_toplevel (toplevel=0x580977860740)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:518
#9 0x000071ce2bb9ff37 in destroy_xdg_surface_role_object (surface=0x5809778672c0)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:434
#10 0x000071ce2bba00d0 in destroy_xdg_surface (surface=0x5809778672c0)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:466
#11 0x000071ce2bb9eb26 in xdg_client_handle_resource_destroy (resource=0x58097788b770)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_shell.c:70
#12 0x000071ce2b4b92b1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#13 0x000071ce2b4b9a4b in wl_client_destroy () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#14 0x000071ce2b4ba1e1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#15 0x000071ce2b4b9402 in wl_event_loop_dispatch () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#16 0x000071ce2b4b9c45 in wl_display_run () at /lib/x86_64-linux-gnu/libwayland-server.so.0
#17 0x000058097536cb58 in server_run (server=0x5809753f4680 <server>) at ../sway/server.c:398
#18 0x000058097536b82f in main (argc=1, argv=0x7ffd3b837148) at ../sway/main.c:415
(gdb) frame 2
#2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58
58			seat_set_raw_focus(seat, &focus->node);
(gdb) print focus
1ドル = (struct sway_container *) 0x0
I managed to make volare crash in `container_add_placeholder_child()`. I think the commonality with the previous crash in `container_remove_placeholder_and_parent()` is that I happened to be running Zoom at the time, which is definitely an application that stresses tiling window managers. (Albeit, in the background and not actively in a Zoom meeting.) It looks like `seat_get_focused_container()` can legitimately return NULL, so we need to add a NULL check before dereferencing the result. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338 338 if (node->type == N_ROOT || node->type == N_OUTPUT) { [Current thread is 1 (Thread 0x71ce2a4fdf00 (LWP 94057))] (gdb) bt #0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338 #1 0x00005809753868bf in seat_set_raw_focus (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:1169 #2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58 #3 0x00005809753b5c3a in container_reap_empty (con=0x58097730c1a0) at ../sway/tree/container.c:221 #4 0x00005809753bf9c6 in view_unmap (view=0x5809778acec0) at ../sway/tree/view.c:907 #5 0x00005809753798fc in handle_unmap (listener=0x5809778ad0e8, data=0x0) at ../sway/desktop/xdg_shell.c:422 #6 0x000071ce2b4b78fc in wl_signal_emit_mutable () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #7 0x000071ce2bba52ea in wlr_surface_unmap (surface=0x58097784cfc0) at ../subprojects/wlroots/types/wlr_compositor.c:761 #8 0x000071ce2bba1bd4 in destroy_xdg_toplevel (toplevel=0x580977860740) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:518 #9 0x000071ce2bb9ff37 in destroy_xdg_surface_role_object (surface=0x5809778672c0) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:434 #10 0x000071ce2bba00d0 in destroy_xdg_surface (surface=0x5809778672c0) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:466 #11 0x000071ce2bb9eb26 in xdg_client_handle_resource_destroy (resource=0x58097788b770) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_shell.c:70 #12 0x000071ce2b4b92b1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #13 0x000071ce2b4b9a4b in wl_client_destroy () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #14 0x000071ce2b4ba1e1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #15 0x000071ce2b4b9402 in wl_event_loop_dispatch () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #16 0x000071ce2b4b9c45 in wl_display_run () at /lib/x86_64-linux-gnu/libwayland-server.so.0 #17 0x000058097536cb58 in server_run (server=0x5809753f4680 <server>) at ../sway/server.c:398 #18 0x000058097536b82f in main (argc=1, argv=0x7ffd3b837148) at ../sway/main.c:415 (gdb) frame 2 #2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58 58 seat_set_raw_focus(seat, &focus->node); (gdb) print focus 1ドル = (struct sway_container *) 0x0
I managed to make volare crash in `container_add_placeholder_child()`.
I think the commonality with the previous crash in
`container_remove_placeholder_and_parent()` is that I happened to
be running Zoom at the time, which is definitely an application that
stresses tiling window managers. (Albeit, in the background and not
actively in a Zoom meeting.)
It looks like `seat_get_focused_container()` can legitimately return
NULL, so we need to add a NULL check before dereferencing the result.
 Program terminated with signal SIGSEGV, Segmentation fault.
 #0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338
 338		if (node->type == N_ROOT || node->type == N_OUTPUT) {
 [Current thread is 1 (Thread 0x71ce2a4fdf00 (LWP 94057))]
 (gdb) bt
 #0 0x000058097538452e in seat_node_from_node (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:338
 #1 0x00005809753868bf in seat_set_raw_focus (seat=0x580977182de0, node=0x0) at ../sway/input/seat.c:1169
 #2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58
 #3 0x00005809753b5c3a in container_reap_empty (con=0x58097730c1a0) at ../sway/tree/container.c:221
 #4 0x00005809753bf9c6 in view_unmap (view=0x5809778acec0) at ../sway/tree/view.c:907
 #5 0x00005809753798fc in handle_unmap (listener=0x5809778ad0e8, data=0x0) at ../sway/desktop/xdg_shell.c:422
 #6 0x000071ce2b4b78fc in wl_signal_emit_mutable () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #7 0x000071ce2bba52ea in wlr_surface_unmap (surface=0x58097784cfc0)
 at ../subprojects/wlroots/types/wlr_compositor.c:761
 #8 0x000071ce2bba1bd4 in destroy_xdg_toplevel (toplevel=0x580977860740)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:518
 #9 0x000071ce2bb9ff37 in destroy_xdg_surface_role_object (surface=0x5809778672c0)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:434
 #10 0x000071ce2bba00d0 in destroy_xdg_surface (surface=0x5809778672c0)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:466
 #11 0x000071ce2bb9eb26 in xdg_client_handle_resource_destroy (resource=0x58097788b770)
 at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_shell.c:70
 #12 0x000071ce2b4b92b1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #13 0x000071ce2b4b9a4b in wl_client_destroy () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #14 0x000071ce2b4ba1e1 in ??? () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #15 0x000071ce2b4b9402 in wl_event_loop_dispatch () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #16 0x000071ce2b4b9c45 in wl_display_run () at /lib/x86_64-linux-gnu/libwayland-server.so.0
 #17 0x000058097536cb58 in server_run (server=0x5809753f4680 <server>) at ../sway/server.c:398
 #18 0x000058097536b82f in main (argc=1, argv=0x7ffd3b837148) at ../sway/main.c:415
 (gdb) frame 2
 #2 0x00005809753b560e in container_add_placeholder_child (parent=0x58097730c1a0) at ../sway/tree/container.c:58
 58			seat_set_raw_focus(seat, &focus->node);
 (gdb) print focus
 1ドル = (struct sway_container *) 0x0
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
raboof/volare!87
Reference in a new issue
raboof/volare
No description provided.
Delete branch "edmonds/volare:edmonds/crash/container_add_placeholder_child"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?