Files
Dag-Erling Smørgrav 1c821dc49b hastd: Use fixed-length protocol names
All communication between hastd nodes and internally between hastd 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 hastd 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 hastd requires one).

Note that this issue appears to have been reported independently first
by Alessandro Sagratini in PR 292322 and then by Martin Vidovic in
D57511.  I ended up going in a different direction than Martin's patch,
but his analysis was invaluable, hence the double credit below.

Approved by:	so
Security:	FreeBSD-EN-26:26.hastd
PR:		292322
Reported by:	Martin Vidovic <[email protected]>
MFC after:	1 week
Event:		EuroBSDcon DevSummit 2026
Reviewed by:	xtronom_gmail.com, kevans, glebius, gjb
Differential Revision:	https://reviews.freebsd.org/D59521

(cherry picked from commit b7e5c2e008)
(cherry picked from commit 9401bfb061)
2026-10-13 13:47:11 +00:00
..
2025-11-20 10:37:34 -05:00
2023-08-16 11:55:20 -06:00
2026-01-05 12:01:01 -08:00
2025-01-23 22:36:03 -05:00
2026-01-31 17:50:03 +00:00
2026-01-30 13:00:35 -08:00
2025-07-19 02:03:53 +01:00