Page MenuHomeFreeBSD

auditdistd: Use fixed-length protocol names
AcceptedPublic

Authored by des on Sep 10 2026, 9:47 AM.
Tags
None
Referenced Files
F175359801: D59565.id.diff
Sat, Oct 10, 6:55 AM
F175351617: D59565.id186359.diff
Sat, Oct 10, 5:28 AM
Unknown Object (File)
Fri, Oct 9, 6:47 AM
Unknown Object (File)
Thu, Oct 8, 5:32 PM
Unknown Object (File)
Wed, Oct 7, 11:05 PM
Unknown Object (File)
Wed, Oct 7, 7:15 PM
Unknown Object (File)
Wed, Oct 7, 9:10 AM
Unknown Object (File)
Mon, Oct 5, 1:10 PM
Subscribers

Details

Reviewers
pjd
kevans
js
Summary

All communication between auditdistd senders and receivers and
internally between auditdistd and its worker children passes through the
same pair of send / receive functions. The receive function uses
recv(2) with the MSG_WAITALL flag, which in theory means we should never
get a short read. However, when handing off a socket to a worker child,
we also pass a variable-length string identifying the type of socket
we're passing, and reading this string relies on a short read. This
used to work because the arrival of the descriptor would interrupt the
recv(2) call, but this bug was fixed when the AF_UNIX code was rewritten
a while ago and auditdistd has been broken ever since.

Fixing the length of the protocol name to four characters including the
terminating null solves the short-read bug by never requiring a short
read (nothing else in auditdistd requires one).

MFC after: 3 days
Event: EuroBSDcon DevSummit 2026

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76737
Build 73620: arc lint + arc unit

Event Timeline

des requested review of this revision.Sep 10 2026, 9:47 AM
js added a subscriber: js.

Tested it and it works fine. Thanks des

This revision is now accepted and ready to land.Mon, Oct 5, 1:19 PM
This revision now requires review to proceed.Mon, Oct 5, 1:22 PM
This revision is now accepted and ready to land.Mon, Oct 5, 1:49 PM

This may work, but it seems a little bit fragile. Would it not be more robust to omit the MSG_WAITALL for the call when recv is expecting a variable-length string?

@des what do you think of the alternate solution in D60489 ? I think it's more robust, because it doesn't require the socket names and receive buffers to be exactly matched in size.