Page MenuHomeFreeBSD

auditdistd: Use fixed-length protocol names
AcceptedPublic

Authored by des on Thu, Sep 10, 9:47 AM.
Tags
None
Referenced Files
F175056623: D59565.id188704.diff
Wed, Oct 7, 11:05 PM
F175034321: D59565.diff
Wed, Oct 7, 7:15 PM
Unknown Object (File)
Wed, Oct 7, 9:10 AM
Unknown Object (File)
Mon, Oct 5, 1:10 PM
Unknown Object (File)
Thu, Oct 1, 2:39 AM
Unknown Object (File)
Wed, Sep 30, 6:01 PM
Unknown Object (File)
Wed, Sep 30, 1:59 AM
Unknown Object (File)
Tue, Sep 29, 5:52 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 77715
Build 74598: arc lint + arc unit

Event Timeline

des requested review of this revision.Thu, Sep 10, 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?