Hello,
I’m hitting a server crash (SIGSEGV) on tmux next-3.7 (31d77e29) when control_notify_paste_buffer_deleted() calls control_write() on a client whose control_state has not yet been initialized.
Environment$ uname -sp && tmux -V && echo $TERM Darwin i386 tmux next-3.7 screen-256colorSIGSEGV at address 0x0000000000000020 (NULL + 32 byte struct offset).
3 crashes in a single day, all identical backtrace:
macOS crash report excerpt:
"exception": { "type": "EXC_BAD_ACCESS", "signal": "SIGSEGV", "subtype": "KERN_INVALID_ADDRESS at 0x0000000000000020" } Root causeCONTROL_SHOULD_NOTIFY_CLIENT(c) checks (c)->flags & CLIENT_CONTROL but does not check (c)->control_state != NULL. There is a window between MSG_IDENTIFY_FLAGS (which sets CLIENT_CONTROL) and MSG_IDENTIFY_DONE (which calls control_start() to allocate control_state) where a notification can fire and hit the uninitialized pointer.
Additionally, control_stop() frees control_state but never NULLs the pointer, leaving a dangling reference during teardown.
Steps to reproduceIn our case, a tmux-based agent orchestration system maintains ~12 persistent control-mode connections (one per session) and E2E tests send multiline text via load-buffer + paste-buffer -p -d at high frequency.
PatchAttached: 0001-Fix-NULL-dereference-in-control_write-when-control_s.patch
Three changes:
I agree to make this contribution under tmux’s current license.
Server logstmux was running with -v. The last lines of the server log before the crash show successful %paste-buffer-deleted notifications to 12 control clients, then the crash on the next client in the iteration:
notify_add: hook=paste-buffer-deleted control_vwrite: client-8070: writing line: %paste-buffer-deleted tt-1775900157427 control_vwrite: client-8082: writing line: %paste-buffer-deleted tt-1775900157427 ... control_vwrite: client-9270: writing line: %paste-buffer-deleted tt-1775900157427Server log (4.1GB, verbose) and core dump (6.9GB) available if needed.
Best,
Edwin
--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/31e2f4c8-f8fa-47d6-82ff-9dc6ae99ca34n%40googlegroups.com.