Skip to content

Fix FreeBSD 15.0+ SOCK_SEQPACKET message boundary issue#638

Merged
jnovy merged 1 commit intocontainers:mainfrom
jnovy:freebsd
Feb 24, 2026
Merged

Fix FreeBSD 15.0+ SOCK_SEQPACKET message boundary issue#638
jnovy merged 1 commit intocontainers:mainfrom
jnovy:freebsd

Conversation

@jnovy
Copy link
Collaborator

@jnovy jnovy commented Feb 23, 2026

On FreeBSD 15.0+, SOCK_SEQPACKET sockets require MSG_EOR flag to mark message boundaries. Using write() without MSG_EOR causes multiple messages to coalesce when reader is slow, leading to frame desynchronization and "output destination cannot be nil" errors.

This fix uses send() with MSG_EOR on FreeBSD while keeping the original write_all() behavior on other platforms.

Fixes: containers/podman#27918

On FreeBSD 15.0+, SOCK_SEQPACKET sockets require MSG_EOR flag to mark
message boundaries. Using write() without MSG_EOR causes multiple
messages to coalesce when reader is slow, leading to frame
desynchronization and "output destination cannot be nil" errors.

This fix uses send() with MSG_EOR on FreeBSD while keeping the original
write_all() behavior on other platforms.

Fixes: containers/podman#27918

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
@jnovy jnovy requested a review from giuseppe February 23, 2026 19:47
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jnovy jnovy merged commit 9e471ba into containers:main Feb 24, 2026
35 of 37 checks passed
@dfr
Copy link
Contributor

dfr commented Feb 24, 2026

I believe that send(..., MSG_EOR) will also work on Linux but have not tested this. The call to write_all on Linux will only call write(2) once otherwise we would see the framing bug. For unix domain sequenced packet sockets on Linux, write(2) is equivalent to send(2) with MSG_EOR.

Having said this, making the change conditional on FreeBSD is fine (and lower risk). Thanks for working on this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants