ladybird/Libraries/LibIPC
sideshowbarker c551a8094a LibIPC: Don’t dispatch queued messages when sync IPC peer disconnects
Problem: When the browser is closed during startup, we crash inside
PageHost::attach_compositor_ui_client() — on what looks like a normal
null check, but which is actually reading uninitialized memory.

Cause: A sync allocate_compositor_context_id IPC call is issued by the
PageHost constructor before ConnectionFromClient::m_page_host has been
assigned. The sync call runs inside the initializer that’s still
computing m_page_host’s value. If a peer disconnects before responding
(e.g., during shutdown), wait_for_specific_endpoint_message_impl’s
failure path drains any still-queued messages via handle_messages().
One of those is the initial ConnectToCompositor, which dispatches to
m_page_host->attach_compositor_ui_client() — but m_page_host is
uninitialized garbage at that point, so the call segfaults.

Fix: On peer EOF, stop draining queued messages from the failure path.
Re-entering arbitrary handlers from any sync IPC wait is unsafe — since
that wait can be reached from a constructor whose members are still
being initialized. Instead, call shutdown() to close the transport and
invoke die(). That exits processes cleanly via _exit(0) — achieving the
same effect the queued close_server message would’ve had.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/9582
2026-05-24 10:00:31 +02:00
..
Attachment.cpp Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
Attachment.h Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
AttachmentMachPort.cpp Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
AutoCloseFileDescriptor.cpp Everywhere: Remove LibCore/System.h includes from header files 2025-12-04 15:40:46 +00:00
AutoCloseFileDescriptor.h Everywhere: Remove LibCore/System.h includes from header files 2025-12-04 15:40:46 +00:00
CMakeLists.txt LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
Concepts.h LibIPC: Support DistinctNumeric serialization 2026-05-21 11:45:06 +01:00
Connection.cpp LibIPC: Don’t dispatch queued messages when sync IPC peer disconnects 2026-05-24 10:00:31 +02:00
Connection.h LibIPC+LibWeb: Introduce IPC::Attachment abstraction 2026-03-13 20:22:50 +01:00
ConnectionFromClient.h LibIPC: Simplify IPC read hook 2025-10-21 09:31:22 +02:00
ConnectionToServer.h Everywhere: Make TransportSocket non-movable 2025-04-09 15:27:52 +02:00
Decoder.cpp LibIPC: Remove unused header in Decoder 2026-02-23 12:15:23 +01:00
Decoder.h LibIPC: Support DistinctNumeric serialization 2026-05-21 11:45:06 +01:00
Encoder.cpp LibIPC+LibWeb: Introduce IPC::Attachment abstraction 2026-03-13 20:22:50 +01:00
Encoder.h LibIPC+LibGfx: Add IPC serialization for typefaces 2026-05-21 11:45:06 +01:00
File.cpp LibIPC: Move Windows handle serialization into TransportSocketWindows 2026-04-08 20:19:05 +02:00
File.h Everywhere: Remove LibCore/System.h includes from header files 2025-12-04 15:40:46 +00:00
Forward.h Everywhere: Move Mach bootstrap listener into LibIPC 2026-03-24 19:51:52 +01:00
HandleType.h LibIPC: Port to Windows 2025-02-12 22:31:43 -07:00
Limits.h LibIPC: Move IPC message limits to a shared Limits.h header 2026-01-22 17:38:15 +01:00
MachBootstrapListener.cpp Everywhere: Move Mach bootstrap listener into LibIPC 2026-03-24 19:51:52 +01:00
MachBootstrapListener.h Everywhere: Move Mach bootstrap listener into LibIPC 2026-03-24 19:51:52 +01:00
MachBootstrapMessages.h Everywhere: Move Mach bootstrap listener into LibIPC 2026-03-24 19:51:52 +01:00
Message.cpp LibIPC+LibWeb: Introduce IPC::Attachment abstraction 2026-03-13 20:22:50 +01:00
Message.h LibIPC: Return a StringView for IPC message names 2026-04-23 09:42:07 -04:00
SingleServer.h Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
Stub.h Meta: Enforce newlines around namespaces 2025-05-14 02:01:59 -06:00
Transport.h Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
TransportBootstrapMach.cpp LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
TransportBootstrapMach.h LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
TransportHandle.cpp LibIPC: Dont VERIFY when encoding placeholder TransportHandles 2026-04-29 01:07:11 +02:00
TransportHandle.h Everywhere: Replace Unix socket IPC transport with Mach ports on macOS 2026-03-23 18:50:48 +01:00
TransportMachPort.cpp LibIPC: Handle invalid Mach port descriptors gracefully 2026-05-12 20:57:08 +02:00
TransportMachPort.h LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
TransportSocket.cpp LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
TransportSocket.h LibThreading/LibSync: Split out sync primitives 2026-05-08 18:58:35 -05:00
TransportSocketWindows.cpp LibIPC: Move Windows handle serialization into TransportSocketWindows 2026-04-08 20:19:05 +02:00
TransportSocketWindows.h LibIPC: Move Windows handle serialization into TransportSocketWindows 2026-04-08 20:19:05 +02:00