Skip to content

fix (crash): refuse a surface as its own parent - #2257

Open
LinuxBoy-96 wants to merge 1 commit into
Smithay:masterfrom
LinuxBoy-96:C63
Open

LinuxBoy-96 wants to merge 1 commit into
Smithay:masterfrom
LinuxBoy-96:C63

Conversation

@LinuxBoy-96

Copy link
Copy Markdown
  • Problem: the set_parent_of handler calls with_states(&child, …), which locks the child surface's state, and inside that closure calls is_valid_parent(child, parent). That function first calls is_toplevel_equivalent(parent) → get_role(parent), which locks the parent surface's state. When parent and child are the same surface (export a toplevel, import the handle, then set_parent_of the same surface), it re-locks the same non-reentrant mutex and deadlocks. The parent-loop guard (*child == parent) is meant to reject exactly this, but it runs only after the re-lock.
  • When: any client binds zxdg_exporter_v2 + zxdg_importer_v2, exports one of its toplevels, imports the handle, and calls set_parent_of with that same surface. The global is unfiltered.
  • Consequence: the compositor's main thread deadlocks (confirmed: 0% CPU, waiting on a futex); it stops serving every client — a full session freeze, never caught.
  • Fix (smithay): resolve the parent's role and run is_valid_parent before taking with_states(&child), or special-case parent == child.

Checklist

@LinuxBoy-96 LinuxBoy-96 changed the title xdg_foreign: refuse a surface as its own parent Nov 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant